X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/96fe9fc822c2270cb6e4212798d61e61481ec2e0..2945ea907a7c35da2d03d6775574fb1ad9be2b09:/services/api/lib/current_api_client.rb diff --git a/services/api/lib/current_api_client.rb b/services/api/lib/current_api_client.rb index 94bd2b56a8..7bd475278c 100644 --- a/services/api/lib/current_api_client.rb +++ b/services/api/lib/current_api_client.rb @@ -158,4 +158,24 @@ module CurrentApiClient $anonymous_user end + def empty_collection_uuid + 'd41d8cd98f00b204e9800998ecf8427e+0' + end + + def empty_collection + if not $empty_collection + act_as_system_user do + 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 + end end