3527: Support using a Docker image from any stream in a Collection.
[arvados.git] / services / api / lib / current_api_client.rb
index 7100f3a9ebcc5c1b48bce9409c600a7c2f9e71dd..7bd475278ce7d320e643cd2e78e9636f54511995 100644 (file)
@@ -165,10 +165,15 @@ module CurrentApiClient
   def empty_collection
     if not $empty_collection
       act_as_system_user do
-        $empty_collection = Collection.
-          where(uuid: empty_collection_uuid).
-          first_or_create!(owner_uuid: anonymous_group_uuid,
-                           manifest_text: '')
+        ActiveRecord::Base.transaction do
+          $empty_collection = Collection.
+            where(uuid: empty_collection_uuid).
+            first_or_create!(manifest_text: '')
+          Link.where(tail_uuid: anonymous_group.uuid,
+                     head_uuid: empty_collection_uuid,
+                     link_class: 'permission',
+                     name: 'can_read').first_or_create!
+        end
       end
     end
     $empty_collection