[ARVADOS] updated: 33dd05d22ecae6f9028692433096a8e3eca5c71b

git at public.curoverse.com git at public.curoverse.com
Fri Jun 12 11:03:17 EDT 2015


Summary of changes:
 apps/workbench/app/controllers/users_controller.rb   | 18 ++++++++++--------
 apps/workbench/app/views/users/_setup_popup.html.erb |  1 +
 2 files changed, 11 insertions(+), 8 deletions(-)

       via  33dd05d22ecae6f9028692433096a8e3eca5c71b (commit)
      from  c0818b26246432407b8cd76a887dd61a7e824cd0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 33dd05d22ecae6f9028692433096a8e3eca5c71b
Author: radhika <radhika at curoverse.com>
Date:   Fri Jun 12 11:02:13 2015 -0400

    6254: slight performance improvement where the can_login link is not retrieved and checked if the groups passed in are the same as those already saved.

diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index d657f92..c8c0016 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -214,14 +214,15 @@ class UsersController < ApplicationController
         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]
+            prev_groups = params[:prev_groups].split(',').map(&:strip).compact.select{|i| !i.to_s.empty?}
+            if new_groups != prev_groups
+              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
                 props[:groups] = new_groups
                 perm.save!
               end
@@ -354,6 +355,7 @@ class UsersController < ApplicationController
       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(', ')
+ at current_groups = current_selections[:groups]
     end
 
     # repo perm
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index fcc3322..705d2d7 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -65,6 +65,7 @@
       <div class="groups-group">
         <label for="groups">Groups</label>
         <input user_email="user_email" maxlength="250" name="user_email" type="hidden" value="<%=email%>">
+        <input prev_groups="prev_groups" maxlength="250" name="prev_groups" type="hidden" value="<%=groups%>">
         <input class="form-control" id="groups" maxlength="250" name="groups" type="text" value="<%=groups%>"
           title="Comma separated list of groups to which this user belongs">
       </div>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list