X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f3250432a47c835f4c594348b0d4904a247c3365..c0818b26246432407b8cd76a887dd61a7e824cd0:/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 0ca5a85f01..d657f92603 100644 --- a/apps/workbench/app/controllers/users_controller.rb +++ b/apps/workbench/app/controllers/users_controller.rb @@ -52,15 +52,15 @@ class UsersController < ApplicationController 1.month.ago.beginning_of_month, Time.now.beginning_of_month]] @spans.each do |span, threshold_start, threshold_end| - @activity[:logins][span] = Log. + @activity[:logins][span] = Log.select(%w(uuid modified_by_user_uuid)). filter([[:event_type, '=', 'login'], [:object_kind, '=', 'arvados#user'], [:created_at, '>=', threshold_start], [:created_at, '<', threshold_end]]) - @activity[:jobs][span] = Job. + @activity[:jobs][span] = Job.select(%w(uuid modified_by_user_uuid)). filter([[:created_at, '>=', threshold_start], [:created_at, '<', threshold_end]]) - @activity[:pipeline_instances][span] = PipelineInstance. + @activity[:pipeline_instances][span] = PipelineInstance.select(%w(uuid modified_by_user_uuid)). filter([[:created_at, '>=', threshold_start], [:created_at, '<', threshold_end]]) @activity.each do |type, act| @@ -212,6 +212,22 @@ class UsersController < ApplicationController end if User.setup setup_params + if params[:groups] + new_groups = params[:groups].split(',').map(&:strip).compact.select{|i| !i.to_s.empty?} + can_login_perms = Link.where(tail_uuid: params[:user_email], + head_kind: 'arvados#user', + link_class: 'permission', + name: 'can_login') + if can_login_perms.any? + perm = can_login_perms.first + props = perm.properties + if new_groups != props[:groups] + props[:groups] = new_groups + perm.save! + end + end + end + format.js else self.render_error status: 422 @@ -329,14 +345,15 @@ class UsersController < ApplicationController end # oid login perm - oid_login_perms = Link.where(tail_uuid: user.email, + can_login_perms = Link.where(tail_uuid: user.email, head_kind: 'arvados#user', link_class: 'permission', name: 'can_login') - if oid_login_perms.any? - prefix_properties = oid_login_perms.first.properties - current_selections[:identity_url_prefix] = prefix_properties[:identity_url_prefix] + if can_login_perms.any? + perm_properties = can_login_perms.first.properties + current_selections[:identity_url_prefix] = perm_properties[:identity_url_prefix] + current_selections[:groups] = perm_properties[:groups].andand.join(', ') end # repo perm