[ARVADOS] updated: db9ef7d6f53a413243bf929ac424f11b8cfb3f72

git at public.curoverse.com git at public.curoverse.com
Fri Jun 12 21:21:30 EDT 2015


Summary of changes:
 apps/workbench/app/controllers/users_controller.rb | 41 ++++++++++++----------
 .../app/views/users/_setup_popup.html.erb          |  7 ++--
 2 files changed, 25 insertions(+), 23 deletions(-)

       via  db9ef7d6f53a413243bf929ac424f11b8cfb3f72 (commit)
       via  a2ad62cae1e549d9224c6851b9e7ff0f3470a07a (commit)
       via  af88dd5afc0d5a506bab9ac37ddcfb101e7e05af (commit)
      from  cdec4d7f86b3495649216e112d0f9d31d7fe026d (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 db9ef7d6f53a413243bf929ac424f11b8cfb3f72
Author: radhika <radhika at curoverse.com>
Date:   Fri Jun 12 21:19:35 2015 -0400

    6254: better groups text field label

diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index dd29024..ac3ea60 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -222,7 +222,7 @@ class UsersController < ApplicationController
           end
           if params[:groups]
             new_groups = params[:groups].split(',').map(&:strip).select{|i| !i.empty?}
-            if new_groups != vm_link[:properties][:groups]
+            if vm_link and new_groups != vm_link[:properties][:groups]
               vm_login_link = Link.where(uuid: vm_link[:uuid])
               if vm_login_link.items_available > 0
                 link = vm_login_link.results.first
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 8097b36..2bb94dd 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -63,7 +63,7 @@
         </select>
       </div>
       <div class="groups-group">
-        <label for="groups">Groups (comma separated list)</label>
+        <label for="groups">Groups for Virtual Machine (comma separated list)</label>
         <input class="form-control" id="groups" maxlength="250" name="groups" type="text" value="<%=groups%>">
       </div>
     </div>

commit a2ad62cae1e549d9224c6851b9e7ff0f3470a07a
Author: radhika <radhika at curoverse.com>
Date:   Fri Jun 12 21:06:23 2015 -0400

    6254: instead of tooltip, use a self explanatory label for groups text field.

diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index 0b74977..dd29024 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -213,25 +213,22 @@ class UsersController < ApplicationController
 
         setup_resp = User.setup setup_params
         if setup_resp
-          prev_groups = nil
+          vm_link = nil
           setup_resp[:items].each do |item|
             if item[:head_kind] == "arvados#virtualMachine"
-              prev_groups = item[:properties][:groups]
+              vm_link = item
               break
             end
           end
           if params[:groups]
             new_groups = params[:groups].split(',').map(&:strip).select{|i| !i.empty?}
-            if new_groups != prev_groups
-              vm_login_perms = Link.where(tail_uuid: params['user_uuid'],
-                                          head_kind: 'arvados#virtualMachine',
-                                          link_class: 'permission',
-                                          name: 'can_login')
-              if vm_login_perms.any?
-                perm = vm_login_perms.first
-                props = perm.properties
+            if new_groups != vm_link[:properties][:groups]
+              vm_login_link = Link.where(uuid: vm_link[:uuid])
+              if vm_login_link.items_available > 0
+                link = vm_login_link.results.first
+                props = link.properties
                 props[:groups] = new_groups
-                perm.save!
+                link.save!
               end
             end
           end
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 8e3b4c4..8097b36 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -63,9 +63,8 @@
         </select>
       </div>
       <div class="groups-group">
-        <label for="groups">Groups</label>
-        <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">
+        <label for="groups">Groups (comma separated list)</label>
+        <input class="form-control" id="groups" maxlength="250" name="groups" type="text" value="<%=groups%>">
       </div>
     </div>
 

commit af88dd5afc0d5a506bab9ac37ddcfb101e7e05af
Author: radhika <radhika at curoverse.com>
Date:   Fri Jun 12 20:26:28 2015 -0400

    7254: add groups to vm link.

diff --git a/apps/workbench/app/controllers/users_controller.rb b/apps/workbench/app/controllers/users_controller.rb
index b6b9f7d..0b74977 100644
--- a/apps/workbench/app/controllers/users_controller.rb
+++ b/apps/workbench/app/controllers/users_controller.rb
@@ -211,17 +211,24 @@ class UsersController < ApplicationController
           setup_params[:vm_uuid] = params['vm_uuid']
         end
 
-        if User.setup setup_params
+        setup_resp = User.setup setup_params
+        if setup_resp
+          prev_groups = nil
+          setup_resp[:items].each do |item|
+            if item[:head_kind] == "arvados#virtualMachine"
+              prev_groups = item[:properties][:groups]
+              break
+            end
+          end
           if params[:groups]
-            new_groups = params[:groups].split(',').map(&:strip).compact.select{|i| !i.to_s.empty?}
-            prev_groups = params[:prev_groups].split(',').map(&:strip).compact.select{|i| !i.to_s.empty?}
+            new_groups = params[:groups].split(',').map(&:strip).select{|i| !i.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
+              vm_login_perms = Link.where(tail_uuid: params['user_uuid'],
+                                          head_kind: 'arvados#virtualMachine',
+                                          link_class: 'permission',
+                                          name: 'can_login')
+              if vm_login_perms.any?
+                perm = vm_login_perms.first
                 props = perm.properties
                 props[:groups] = new_groups
                 perm.save!
@@ -346,15 +353,14 @@ class UsersController < ApplicationController
     end
 
     # oid login perm
-    can_login_perms = Link.where(tail_uuid: user.email,
+    oid_login_perms = Link.where(tail_uuid: user.email,
                                    head_kind: 'arvados#user',
                                    link_class: 'permission',
                                    name: 'can_login')
 
-    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(', ')
+    if oid_login_perms.any?
+      prefix_properties = oid_login_perms.first.properties
+      current_selections[:identity_url_prefix] = prefix_properties[:identity_url_prefix]
     end
 
     # repo perm
@@ -377,8 +383,10 @@ class UsersController < ApplicationController
                               link_class: 'permission',
                               name: 'can_login')
     if vm_login_perms.any?
-      vm_uuid = vm_login_perms.first.head_uuid
+      vm_perm = vm_login_perms.first
+      vm_uuid = vm_perm.head_uuid
       current_selections[:vm_uuid] = vm_uuid
+      current_selections[:groups] = vm_perm.properties[:groups].andand.join(', ')
     end
 
     return current_selections
diff --git a/apps/workbench/app/views/users/_setup_popup.html.erb b/apps/workbench/app/views/users/_setup_popup.html.erb
index 705d2d7..8e3b4c4 100644
--- a/apps/workbench/app/views/users/_setup_popup.html.erb
+++ b/apps/workbench/app/views/users/_setup_popup.html.erb
@@ -64,8 +64,6 @@
       </div>
       <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