X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f6b88a9e7e9727f0397f1febbad8c08f6a20463d..cdff1d7e5eadb611578090585e1e54aae41e7e66:/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 2e78612fc2..711c663a23 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 @@ -124,12 +134,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