Class: SignIn::CredentialLevel
- Inherits:
-
Object
- Object
- SignIn::CredentialLevel
- Includes:
- ActiveModel::Validations
- Defined in:
- app/models/sign_in/credential_level.rb
Instance Attribute Summary collapse
-
#auto_uplevel ⇒ Object
readonly
Returns the value of attribute auto_uplevel.
-
#credential_type ⇒ Object
readonly
Returns the value of attribute credential_type.
-
#current_ial ⇒ Object
readonly
Returns the value of attribute current_ial.
-
#max_ial ⇒ Object
readonly
Returns the value of attribute max_ial.
-
#requested_acr ⇒ Object
readonly
Returns the value of attribute requested_acr.
Instance Method Summary collapse
- #can_uplevel_credential? ⇒ Boolean
-
#initialize(requested_acr:, credential_type:, current_ial:, max_ial:, auto_uplevel: false) ⇒ CredentialLevel
constructor
A new instance of CredentialLevel.
- #max_ial_greater_than_or_equal_to_current_ial ⇒ Object private
- #persisted? ⇒ Boolean private
Constructor Details
#initialize(requested_acr:, credential_type:, current_ial:, max_ial:, auto_uplevel: false) ⇒ CredentialLevel
Returns a new instance of CredentialLevel.
21 22 23 24 25 26 27 28 29 |
# File 'app/models/sign_in/credential_level.rb', line 21 def initialize(requested_acr:, credential_type:, current_ial:, max_ial:, auto_uplevel: false) @requested_acr = requested_acr @credential_type = credential_type @current_ial = current_ial @max_ial = max_ial @auto_uplevel = auto_uplevel validate! end |
Instance Attribute Details
#auto_uplevel ⇒ Object (readonly)
Returns the value of attribute auto_uplevel.
7 8 9 |
# File 'app/models/sign_in/credential_level.rb', line 7 def auto_uplevel @auto_uplevel end |
#credential_type ⇒ Object (readonly)
Returns the value of attribute credential_type.
7 8 9 |
# File 'app/models/sign_in/credential_level.rb', line 7 def credential_type @credential_type end |
#current_ial ⇒ Object (readonly)
Returns the value of attribute current_ial.
7 8 9 |
# File 'app/models/sign_in/credential_level.rb', line 7 def current_ial @current_ial end |
#max_ial ⇒ Object (readonly)
Returns the value of attribute max_ial.
7 8 9 |
# File 'app/models/sign_in/credential_level.rb', line 7 def max_ial @max_ial end |
#requested_acr ⇒ Object (readonly)
Returns the value of attribute requested_acr.
7 8 9 |
# File 'app/models/sign_in/credential_level.rb', line 7 def requested_acr @requested_acr end |
Instance Method Details
#can_uplevel_credential? ⇒ Boolean
31 32 33 |
# File 'app/models/sign_in/credential_level.rb', line 31 def can_uplevel_credential? requested_acr == Constants::Auth::MIN && current_ial < max_ial end |
#max_ial_greater_than_or_equal_to_current_ial ⇒ Object (private)
41 42 43 |
# File 'app/models/sign_in/credential_level.rb', line 41 def max_ial_greater_than_or_equal_to_current_ial errors.add(:max_ial, 'cannot be less than Current ial') if max_ial.to_i < current_ial.to_i end |
#persisted? ⇒ Boolean (private)
37 38 39 |
# File 'app/models/sign_in/credential_level.rb', line 37 def persisted? false end |