[#10799] reorder methods A->Z
This commit is contained in:
parent
2bf773b0b7
commit
99a1b68185
1 changed files with 5 additions and 4 deletions
|
@ -7,6 +7,7 @@ module APIEntrepriseTokenConcern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
validates :api_entreprise_token, jwt_token: true, allow_blank: true
|
validates :api_entreprise_token, jwt_token: true, allow_blank: true
|
||||||
|
|
||||||
before_save :set_api_entreprise_token_expires_at, if: :will_save_change_to_api_entreprise_token?
|
before_save :set_api_entreprise_token_expires_at, if: :will_save_change_to_api_entreprise_token?
|
||||||
|
|
||||||
def api_entreprise_role?(role)
|
def api_entreprise_role?(role)
|
||||||
|
@ -17,10 +18,6 @@ module APIEntrepriseTokenConcern
|
||||||
self[:api_entreprise_token].presence || Rails.application.secrets.api_entreprise[:key]
|
self[:api_entreprise_token].presence || Rails.application.secrets.api_entreprise[:key]
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_custom_api_entreprise_token?
|
|
||||||
self[:api_entreprise_token].present?
|
|
||||||
end
|
|
||||||
|
|
||||||
def api_entreprise_token_expired?
|
def api_entreprise_token_expired?
|
||||||
APIEntrepriseToken.new(api_entreprise_token).expired?
|
APIEntrepriseToken.new(api_entreprise_token).expired?
|
||||||
end
|
end
|
||||||
|
@ -29,6 +26,10 @@ module APIEntrepriseTokenConcern
|
||||||
api_entreprise_token_expires_at && api_entreprise_token_expires_at <= SOON_TO_EXPIRE_DELAY.from_now
|
api_entreprise_token_expires_at && api_entreprise_token_expires_at <= SOON_TO_EXPIRE_DELAY.from_now
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_custom_api_entreprise_token?
|
||||||
|
self[:api_entreprise_token].present?
|
||||||
|
end
|
||||||
|
|
||||||
def set_api_entreprise_token_expires_at
|
def set_api_entreprise_token_expires_at
|
||||||
self.api_entreprise_token_expires_at = has_custom_api_entreprise_token? ? APIEntrepriseToken.new(api_entreprise_token).expiration : nil
|
self.api_entreprise_token_expires_at = has_custom_api_entreprise_token? ? APIEntrepriseToken.new(api_entreprise_token).expiration : nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue