X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/89fa46a357a5d5fc39721a3ddbe8e857a101eeef..723698bb8951e3b0c6b60db49fa877fa39d550fd:/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 7e71403691..52f2cee064 100644 --- a/services/api/app/models/api_client_authorization.rb +++ b/services/api/app/models/api_client_authorization.rb @@ -406,9 +406,9 @@ class ApiClientAuthorization < ArvadosModel protected def clamp_token_expiration - if !current_user.andand.is_admin && Rails.configuration.API.MaxTokenLifetime > 0 + if Rails.configuration.API.MaxTokenLifetime > 0 max_token_expiration = db_current_time + Rails.configuration.API.MaxTokenLifetime - if (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 && !current_user.andand.is_admin)) self.expires_at = max_token_expiration end end