projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Convert joins to subqueries to fix duplicates in owned_items
[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 dde15f4428de5ce802725ce0fa0429afc5bc7012..3b73f408c3f03bf35f48a0711357a0487fdeee8e 100644
(file)
--- a/
services/api/app/models/api_client_authorization.rb
+++ b/
services/api/app/models/api_client_authorization.rb
@@
-7,7
+7,7
@@
class ApiClientAuthorization < ArvadosModel
after_initialize :assign_random_api_token
serialize :scopes, Array
after_initialize :assign_random_api_token
serialize :scopes, Array
- api_accessible :
superuser, :extend =>
:common do |t|
+ api_accessible :
user, extend:
:common do |t|
t.add :owner_uuid
t.add :user_id
t.add :api_client_id
t.add :owner_uuid
t.add :user_id
t.add :api_client_id
@@
-20,6
+20,8
@@
class ApiClientAuthorization < ArvadosModel
t.add :scopes
end
t.add :scopes
end
+ UNLOGGED_CHANGES = ['last_used_at', 'last_used_by_ip_address', 'updated_at']
+
def assign_random_api_token
self.api_token ||= rand(2**256).to_s(36)
end
def assign_random_api_token
self.api_token ||= rand(2**256).to_s(36)
end
@@
-60,6
+62,12
@@
class ApiClientAuthorization < ArvadosModel
end
def modified_at=(x) end
end
def modified_at=(x) end
+ def logged_attributes
+ attrs = attributes.dup
+ attrs.delete('api_token')
+ attrs
+ end
+
protected
def permission_to_create
protected
def permission_to_create
@@
-71,4
+79,8
@@
class ApiClientAuthorization < ArvadosModel
not self.user_id_changed? and
not self.owner_uuid_changed?)
end
not self.user_id_changed? and
not self.owner_uuid_changed?)
end
+
+ def log_update
+ super unless (changed - UNLOGGED_CHANGES).empty?
+ end
end
end