projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into 7490-datamanager-dont-die-return-error
[arvados.git]
/
services
/
api
/
script
/
get_anonymous_user_token.rb
diff --git
a/services/api/script/get_anonymous_user_token.rb
b/services/api/script/get_anonymous_user_token.rb
index 76e20880a58a90037d83adbda619e3adb539e9db..6964af0b63fd5db32025c16c393a4082767eb991 100755
(executable)
--- a/
services/api/script/get_anonymous_user_token.rb
+++ b/
services/api/script/get_anonymous_user_token.rb
@@
-27,6
+27,7
@@
def create_api_client_auth
api_client_auth = ApiClientAuthorization.
new(user: anonymous_user,
api_client_id: 0,
api_client_auth = ApiClientAuthorization.
new(user: anonymous_user,
api_client_id: 0,
+ expires_at: Time.now + 100.years,
scopes: ['GET /'])
api_client_auth.save!
api_client_auth.reload
scopes: ['GET /'])
api_client_auth.save!
api_client_auth.reload
@@
-34,7
+35,10
@@
end
if get_existing
api_client_auth = ApiClientAuthorization.
if get_existing
api_client_auth = ApiClientAuthorization.
- where('user_id=?', anonymous_user.id.to_i).first
+ where('user_id=?', anonymous_user.id.to_i).
+ where('expires_at>?', Time.now).
+ select { |auth| auth.scopes == ['GET /'] }.
+ first
end
# either not a get or no api_client_auth was found
end
# either not a get or no api_client_auth was found