X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9197c69b5780a5b5ce9c40bd67e530aefdf0c7a9..4177bcc9b935391630c874a2abcedb81efa350f0:/apps/workbench/app/controllers/users_controller.rb diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb index f9a74e2c73..02f1d83cdc 100644 --- a/apps/workbench/app/controllers/users_controller.rb +++ b/apps/workbench/app/controllers/users_controller.rb @@ -1,20 +1,35 @@ class UsersController < ApplicationController skip_before_filter :find_object_by_uuid, :only => :welcome - skip_around_filter :thread_with_api_token, :only => :welcome - around_filter :thread_with_optional_api_token, :only => :welcome + skip_around_filter :thread_with_mandatory_api_token, :only => :welcome + before_filter :ensure_current_user_is_admin, only: :sudo def welcome if current_user - redirect_to home_user_path(current_user.uuid) + params[:action] = 'home' + home end end + def show_pane_list + if current_user.andand.is_admin + super | %w(Admin) + else + super + end + end + + def sudo + resp = $arvados_api_client.api(ApiClientAuthorization, '', { + api_client_authorization: { + owner_uuid: @object.uuid + } + }) + redirect_to root_url(api_token: resp[:api_token]) + end + def home @showallalerts = false @my_ssh_keys = AuthorizedKey.where(authorized_user_uuid: current_user.uuid) - # @my_vm_perms = Link.where(tail_uuid: current_user.uuid, head_kind: 'arvados#virtual_machine', link_class: 'permission', name: 'can_login') - # @my_repo_perms = Link.where(tail_uuid: current_user.uuid, head_kind: 'arvados#repository', link_class: 'permission', name: 'can_write') - @my_tag_links = {} @my_jobs = Job. @@ -53,5 +68,9 @@ class UsersController < ApplicationController @tutorial_complete = { 'Run a job' => @my_last_job } + respond_to do |f| + f.js { render template: 'users/home.js' } + f.html { render template: 'users/home' } + end end end