X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/27ffca811e6f43225fc82d582d1962eebbd1ab6e..2bcd1451cbcad6e96610f0ddfe14a19f8dd4a3ba:/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 82dd0ec2b6..499a61b7d3 100644 --- a/services/api/app/models/api_client_authorization.rb +++ b/services/api/app/models/api_client_authorization.rb @@ -1,4 +1,5 @@ class ApiClientAuthorization < ArvadosModel + include HasUuid include KindAndEtag include CommonApiTemplate @@ -30,23 +31,12 @@ class ApiClientAuthorization < ArvadosModel self.user.andand.uuid end def owner_uuid_was - self.user_id_changed? ? User.find(self.user_id_was).andand.uuid : self.user.andand.uuid + self.user_id_changed? ? User.where(id: self.user_id_was).first.andand.uuid : self.user.andand.uuid end def owner_uuid_changed? self.user_id_changed? end - def uuid - self.api_token - end - def uuid=(x) end - def uuid_was - self.api_token_was - end - def uuid_changed? - self.api_token_changed? - end - def modified_by_client_uuid nil end @@ -80,6 +70,10 @@ class ApiClientAuthorization < ArvadosModel attrs end + def self.default_orders + ["#{table_name}.id desc"] + end + protected def permission_to_create @@ -88,8 +82,9 @@ class ApiClientAuthorization < ArvadosModel def permission_to_update (permission_to_create and - not self.user_id_changed? and - not self.owner_uuid_changed?) + not uuid_changed? and + not user_id_changed? and + not owner_uuid_changed?) end def log_update