X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a41baffe4f38019cb5b36875c5e0c838ef9201e5..035b113f60302f6d9c265e6e3a63dbb3c5873153:/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 6c1ff2807e..49638677b1 100644 --- a/services/api/lib/current_api_client.rb +++ b/services/api/lib/current_api_client.rb @@ -1,3 +1,15 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + +$system_user = nil +$system_group = nil +$all_users_group = nil +$anonymous_user = nil +$anonymous_group = nil +$anonymous_group_read_permission = nil +$empty_collection = nil + module CurrentApiClient def current_user Thread.current[:user] @@ -83,9 +95,7 @@ module CurrentApiClient User.all.collect(&:uuid).each do |user_uuid| Link.create!(link_class: 'permission', name: 'can_manage', - tail_kind: 'arvados#group', tail_uuid: system_group_uuid, - head_kind: 'arvados#user', head_uuid: user_uuid) end end @@ -146,6 +156,18 @@ module CurrentApiClient end end + def anonymous_group_read_permission + $anonymous_group_read_permission = + check_cache $anonymous_group_read_permission do + act_as_system_user do + Link.where(tail_uuid: all_users_group.uuid, + head_uuid: anonymous_group.uuid, + link_class: "permission", + name: "can_read").first_or_create! + end + end + end + def anonymous_user $anonymous_user = check_cache $anonymous_user do act_as_system_user do