X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7d258618cbfa7b071d81b6bf7fa18c344d2b5f87..cbc29982e30fd776c194c47dc584710ff1b340c4:/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 eb07fc3757..86e982368c 100644 --- a/apps/workbench/app/controllers/users_controller.rb +++ b/apps/workbench/app/controllers/users_controller.rb @@ -5,6 +5,18 @@ class UsersController < ApplicationController skip_before_filter :find_object_by_uuid, only: [:welcome, :activity, :storage] before_filter :ensure_current_user_is_admin, only: [:sudo, :unsetup, :setup] + def show + if params[:uuid] == current_user.uuid + respond_to do |f| + f.html do + redirect_to(params[:return_to] || project_path(params[:uuid])) + end + end + else + super + end + end + def welcome if current_user redirect_to (params[:return_to] || '/') @@ -224,16 +236,18 @@ class UsersController < ApplicationController def manage_account # repositories current user can read / write - repo_links = [] - Link.filter([['head_uuid', 'is_a', 'arvados#repository'], - ['tail_uuid', '=', current_user.uuid], - ['link_class', '=', 'permission'], - ['name', 'in', ['can_write', 'can_read']], - ]). - each do |perm_link| - repo_links << perm_link[:head_uuid] - end - @my_repositories = Repository.where(uuid: repo_links) + repo_links = Link. + filter([['head_uuid', 'is_a', 'arvados#repository'], + ['tail_uuid', '=', current_user.uuid], + ['link_class', '=', 'permission'], + ]) + @my_repositories = Repository.where uuid: repo_links.collect(&:head_uuid) + @repo_writable = {} + repo_links.each do |link| + if link.name.in? ['can_write', 'can_manage'] + @repo_writable[link.head_uuid] = true + end + end # virtual machines the current user can login into @my_vm_logins = {}