X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/36d6d1609ef342268cc87fc8bfce51bcf7199929..3fb81a4db7abbaaa67b7a18d1c4a5ce82bc232dc:/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..fbd4ef5f0c 100644 --- a/services/api/lib/current_api_client.rb +++ b/services/api/lib/current_api_client.rb @@ -124,12 +124,18 @@ module CurrentApiClient end def act_as_user user + #auth_was = Thread.current[:api_client_authorization] user_was = Thread.current[:user] Thread.current[:user] = user + #Thread.current[:api_client_authorization] = ApiClientAuthorization. + # where('user_id=? and scopes is null', user.id). + # order('expires_at desc'). + # first begin yield ensure Thread.current[:user] = user_was + #Thread.current[:api_client_authorization] = auth_was end end @@ -146,6 +152,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