[ARVADOS] updated: e98e77b844dc5a4d2dcfa0752f3bd6b74822d88c

git at public.curoverse.com git at public.curoverse.com
Tue Feb 3 22:15:22 EST 2015


Summary of changes:
 services/api/app/models/user.rb        |  2 +-
 services/api/lib/current_api_client.rb | 22 ++++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

       via  e98e77b844dc5a4d2dcfa0752f3bd6b74822d88c (commit)
       via  549f0a0d6f686d1472b6d5bacc3eb85927c915d5 (commit)
      from  fa166d52969bb6f002fb62b554ef227194e0febe (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 e98e77b844dc5a4d2dcfa0752f3bd6b74822d88c
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Feb 3 22:13:15 2015 -0500

    2659: Fix up chicken-and-egg conditions in seed setup.

diff --git a/services/api/lib/current_api_client.rb b/services/api/lib/current_api_client.rb
index 404de4f..197dcd8 100644
--- a/services/api/lib/current_api_client.rb
+++ b/services/api/lib/current_api_client.rb
@@ -60,7 +60,7 @@ module CurrentApiClient
         Thread.current[:user] = User.new(is_admin: true,
                                          is_active: true,
                                          uuid: system_user_uuid)
-        User.where('uuid=?', system_user_uuid).
+        User.where(uuid: system_user_uuid).
           first_or_create!(is_active: true,
                            is_admin: true,
                            email: 'root',
@@ -79,6 +79,7 @@ module CurrentApiClient
           Group.where(uuid: system_group_uuid).
             first_or_create!(name: "System group",
                              description: "System group") do |g|
+            g.save!
             User.all.collect(&:uuid).each do |user_uuid|
               Link.create!(link_class: 'permission',
                            name: 'can_manage',
@@ -148,18 +149,19 @@ module CurrentApiClient
   def anonymous_user
     $anonymous_user = check_cache $anonymous_user do
       act_as_system_user do
-        anon = User.where('uuid=?', anonymous_user_uuid).
+        User.where(uuid: anonymous_user_uuid).
           first_or_create!(is_active: false,
                            is_admin: false,
                            email: 'anonymous',
                            first_name: 'Anonymous',
-                           last_name: '')
-        Link.where(tail_uuid: anonymous_user_uuid,
-                   head_uuid: anonymous_group_uuid,
-                   link_class: 'permission',
-                   name: 'can_read').
-          first_or_create!
-        anon
+                           last_name: '') do |u|
+          u.save!
+          Link.where(tail_uuid: anonymous_user_uuid,
+                     head_uuid: anonymous_group.uuid,
+                     link_class: 'permission',
+                     name: 'can_read').
+            first_or_create!
+        end
       end
     end
   end
@@ -172,7 +174,7 @@ module CurrentApiClient
     $empty_collection = check_cache $empty_collection do
       act_as_system_user do
         ActiveRecord::Base.transaction do
-          $empty_collection = Collection.
+          Collection.
             where(portable_data_hash: empty_collection_uuid).
             first_or_create!(manifest_text: '', owner_uuid: anonymous_group.uuid)
         end

commit 549f0a0d6f686d1472b6d5bacc3eb85927c915d5
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Feb 3 22:12:06 2015 -0500

    2659: Fix infinite recursion while creating system_user.

diff --git a/services/api/app/models/user.rb b/services/api/app/models/user.rb
index a32ce39..a47a458 100644
--- a/services/api/app/models/user.rb
+++ b/services/api/app/models/user.rb
@@ -411,8 +411,8 @@ class User < ArvadosModel
 
   # Give the special "System group" permission to manage this user and
   # all of this user's stuff.
-  #
   def add_system_group_permission_link
+    return true if uuid == system_user_uuid
     act_as_system_user do
       Link.create(link_class: 'permission',
                   name: 'can_manage',

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list