projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Move @redis.exists and .getrange outside .subscribe block. Otherwise
[arvados.git]
/
services
/
api
/
app
/
models
/
api_client_authorization.rb
diff --git
a/services/api/app/models/api_client_authorization.rb
b/services/api/app/models/api_client_authorization.rb
index c71d0dce4b7aa7abcc5170e641066bfb448b708e..fca57dce8f4d0eb3331c05d442e9fe0fa94f399a 100644
(file)
--- a/
services/api/app/models/api_client_authorization.rb
+++ b/
services/api/app/models/api_client_authorization.rb
@@
-5,30
+5,32
@@
class ApiClientAuthorization < ArvadosModel
belongs_to :api_client
belongs_to :user
after_initialize :assign_random_api_token
belongs_to :api_client
belongs_to :user
after_initialize :assign_random_api_token
+ serialize :scopes, Array
- api_accessible :
superuser, :extend =>
:common do |t|
- t.add :owner
+ api_accessible :
user, extend:
:common do |t|
+ t.add :owner
_uuid
t.add :user_id
t.add :api_client_id
t.add :api_token
t.add :created_by_ip_address
t.add :user_id
t.add :api_client_id
t.add :api_token
t.add :created_by_ip_address
- t.add :default_owner
+ t.add :default_owner
_uuid
t.add :expires_at
t.add :last_used_at
t.add :last_used_by_ip_address
t.add :expires_at
t.add :last_used_at
t.add :last_used_by_ip_address
+ t.add :scopes
end
def assign_random_api_token
self.api_token ||= rand(2**256).to_s(36)
end
end
def assign_random_api_token
self.api_token ||= rand(2**256).to_s(36)
end
- def owner
+ def owner
_uuid
self.user.andand.uuid
end
self.user.andand.uuid
end
- def owner_was
+ def owner_
uuid_
was
self.user_id_changed? ? User.find(self.user_id_was).andand.uuid : self.user.andand.uuid
end
self.user_id_changed? ? User.find(self.user_id_was).andand.uuid : self.user.andand.uuid
end
- def owner_changed?
+ def owner_
uuid_
changed?
self.user_id_changed?
end
self.user_id_changed?
end
@@
-43,15
+45,15
@@
class ApiClientAuthorization < ArvadosModel
self.api_token_changed?
end
self.api_token_changed?
end
- def modified_by_client
+ def modified_by_client
_uuid
nil
end
nil
end
- def modified_by_client=(x) end
+ def modified_by_client
_uuid
=(x) end
- def modified_by_user
+ def modified_by_user
_uuid
nil
end
nil
end
- def modified_by_user=(x) end
+ def modified_by_user
_uuid
=(x) end
def modified_at
nil
def modified_at
nil
@@
-67,6
+69,6
@@
class ApiClientAuthorization < ArvadosModel
def permission_to_update
(permission_to_create and
not self.user_id_changed? and
def permission_to_update
(permission_to_create and
not self.user_id_changed? and
- not self.owner_changed?)
+ not self.owner_
uuid_
changed?)
end
end
end
end