projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
17154: Make sure most current user record is loaded.
[arvados.git]
/
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 b27482c4cc47351bd474244205c8f60ea634f8ea..d782bcb40033b658a5cbfee34aba526662999ab1 100644
(file)
--- a/
apps/workbench/app/controllers/users_controller.rb
+++ b/
apps/workbench/app/controllers/users_controller.rb
@@
-39,11
+39,12
@@
class UsersController < ApplicationController
def profile
params[:offer_return_to] ||= params[:return_to]
def profile
params[:offer_return_to] ||= params[:return_to]
+ Thread.current[:user] = User.find(current_user.uuid)
end
def activity
@breadcrumb_page_name = nil
end
def activity
@breadcrumb_page_name = nil
- @users = User.limit(params[:limit])
+ @users = User.limit(params[:limit])
.with_count("none")
@user_activity = {}
@activity = {
logins: {},
@user_activity = {}
@activity = {
logins: {},
@@
-64,13
+65,13
@@
class UsersController < ApplicationController
filter([[:event_type, '=', 'login'],
[:object_kind, '=', 'arvados#user'],
[:created_at, '>=', threshold_start],
filter([[:event_type, '=', 'login'],
[:object_kind, '=', 'arvados#user'],
[:created_at, '>=', threshold_start],
- [:created_at, '<', threshold_end]])
+ [:created_at, '<', threshold_end]])
.with_count("none")
@activity[:jobs][span] = Job.select(%w(uuid modified_by_user_uuid)).
filter([[:created_at, '>=', threshold_start],
@activity[:jobs][span] = Job.select(%w(uuid modified_by_user_uuid)).
filter([[:created_at, '>=', threshold_start],
- [:created_at, '<', threshold_end]])
+ [:created_at, '<', threshold_end]])
.with_count("none")
@activity[:pipeline_instances][span] = PipelineInstance.select(%w(uuid modified_by_user_uuid)).
filter([[:created_at, '>=', threshold_start],
@activity[:pipeline_instances][span] = PipelineInstance.select(%w(uuid modified_by_user_uuid)).
filter([[:created_at, '>=', threshold_start],
- [:created_at, '<', threshold_end]])
+ [:created_at, '<', threshold_end]])
.with_count("none")
@activity.each do |type, act|
records = act[span]
@users.each do |u|
@activity.each do |type, act|
records = act[span]
@users.each do |u|
@@
-96,7
+97,7
@@
class UsersController < ApplicationController
def storage
@breadcrumb_page_name = nil
def storage
@breadcrumb_page_name = nil
- @users = User.limit(params[:limit])
+ @users = User.limit(params[:limit])
.with_count("none")
@user_storage = {}
total_storage = {}
@log_date = {}
@user_storage = {}
total_storage = {}
@log_date = {}
@@
-124,7
+125,7
@@
class UsersController < ApplicationController
def show_pane_list
if current_user.andand.is_admin
def show_pane_list
if current_user.andand.is_admin
- super | %w(Admin)
+ %w(Admin) | super
else
super
end
else
super
end
@@
-154,11
+155,13
@@
class UsersController < ApplicationController
@my_jobs = Job.
limit(10).
order('created_at desc').
@my_jobs = Job.
limit(10).
order('created_at desc').
+ with_count('none').
where(created_by: current_user.uuid)
@my_collections = Collection.
limit(10).
order('created_at desc').
where(created_by: current_user.uuid)
@my_collections = Collection.
limit(10).
order('created_at desc').
+ with_count('none').
where(created_by: current_user.uuid)
collection_uuids = @my_collections.collect &:uuid
where(created_by: current_user.uuid)
collection_uuids = @my_collections.collect &:uuid
@@
-168,7
+171,7
@@
class UsersController < ApplicationController
end
Link.filter([['head_uuid', 'in', collection_uuids],
end
Link.filter([['head_uuid', 'in', collection_uuids],
- ['link_class', 'in', ['tag', 'resources']]]).
+ ['link_class', 'in', ['tag', 'resources']]]).
with_count("none")
each do |link|
case link.link_class
when 'tag'
each do |link|
case link.link_class
when 'tag'
@@
-183,6
+186,7
@@
class UsersController < ApplicationController
@my_pipelines = PipelineInstance.
limit(10).
order('created_at desc').
@my_pipelines = PipelineInstance.
limit(10).
order('created_at desc').
+ with_count('none').
where(created_by: current_user.uuid)
respond_to do |f|
where(created_by: current_user.uuid)
respond_to do |f|
@@
-264,14
+268,14
@@
class UsersController < ApplicationController
@my_vm_logins = {}
Link.where(tail_uuid: @object.uuid,
link_class: 'permission',
@my_vm_logins = {}
Link.where(tail_uuid: @object.uuid,
link_class: 'permission',
- name: 'can_login').
+ name: 'can_login').
with_count("none").
each do |perm_link|
if perm_link.properties.andand[:username]
@my_vm_logins[perm_link.head_uuid] ||= []
@my_vm_logins[perm_link.head_uuid] << perm_link.properties[:username]
end
end
each do |perm_link|
if perm_link.properties.andand[:username]
@my_vm_logins[perm_link.head_uuid] ||= []
@my_vm_logins[perm_link.head_uuid] << perm_link.properties[:username]
end
end
- @my_virtual_machines = VirtualMachine.where(uuid: @my_vm_logins.keys)
+ @my_virtual_machines = VirtualMachine.where(uuid: @my_vm_logins.keys)
.with_count("none")
end
def ssh_keys
end
def ssh_keys
@@
-335,7
+339,7
@@
class UsersController < ApplicationController
oid_login_perms = Link.where(tail_uuid: user.email,
head_kind: 'arvados#user',
link_class: 'permission',
oid_login_perms = Link.where(tail_uuid: user.email,
head_kind: 'arvados#user',
link_class: 'permission',
- name: 'can_login')
+ name: 'can_login')
.with_count("none")
if oid_login_perms.any?
prefix_properties = oid_login_perms.first.properties
if oid_login_perms.any?
prefix_properties = oid_login_perms.first.properties
@@
-346,10
+350,10
@@
class UsersController < ApplicationController
repo_perms = Link.where(tail_uuid: user.uuid,
head_kind: 'arvados#repository',
link_class: 'permission',
repo_perms = Link.where(tail_uuid: user.uuid,
head_kind: 'arvados#repository',
link_class: 'permission',
- name: 'can_write')
+ name: 'can_write')
.with_count("none")
if repo_perms.any?
repo_uuid = repo_perms.first.head_uuid
if repo_perms.any?
repo_uuid = repo_perms.first.head_uuid
- repos = Repository.where(head_uuid: repo_uuid)
+ repos = Repository.where(head_uuid: repo_uuid)
.with_count("none")
if repos.any?
repo_name = repos.first.name
current_selections[:repo_name] = repo_name
if repos.any?
repo_name = repos.first.name
current_selections[:repo_name] = repo_name
@@
-360,7
+364,7
@@
class UsersController < ApplicationController
vm_login_perms = Link.where(tail_uuid: user.uuid,
head_kind: 'arvados#virtualMachine',
link_class: 'permission',
vm_login_perms = Link.where(tail_uuid: user.uuid,
head_kind: 'arvados#virtualMachine',
link_class: 'permission',
- name: 'can_login')
+ name: 'can_login')
.with_count("none")
if vm_login_perms.any?
vm_perm = vm_login_perms.first
vm_uuid = vm_perm.head_uuid
if vm_login_perms.any?
vm_perm = vm_login_perms.first
vm_uuid = vm_perm.head_uuid