X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/46a5e3958ce98fd1bca4f035dab83ea4c39e6666..864c3b0afd16c77e046f0072d8517d34c5a44792:/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 03e1b38fdc..ee63c4d934 100644 --- a/services/api/app/models/api_client_authorization.rb +++ b/services/api/app/models/api_client_authorization.rb @@ -390,9 +390,7 @@ class ApiClientAuthorization < ArvadosModel def clamp_token_expiration if !current_user.andand.is_admin && Rails.configuration.API.MaxTokenLifetime > 0 max_token_expiration = db_current_time + Rails.configuration.API.MaxTokenLifetime - if self.new_record? && (self.expires_at.nil? || self.expires_at > max_token_expiration) - self.expires_at = max_token_expiration - elsif !self.new_record? && self.expires_at_changed? && (self.expires_at.nil? || self.expires_at > max_token_expiration) + if (self.new_record? || self.expires_at_changed?) && (self.expires_at.nil? || self.expires_at > max_token_expiration) self.expires_at = max_token_expiration end end