Class: Gitlab::ExternalAuthorization::Access
- Inherits:
-
Object
- Object
- Gitlab::ExternalAuthorization::Access
- Defined in:
- lib/gitlab/external_authorization/access.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#load_type ⇒ Object
readonly
Returns the value of attribute load_type.
-
#loaded_at ⇒ Object
readonly
Returns the value of attribute loaded_at.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #has_access? ⇒ Boolean
-
#initialize(user, label) ⇒ Access
constructor
A new instance of Access.
- #load! ⇒ Object
- #loaded? ⇒ Boolean
Constructor Details
#initialize(user, label) ⇒ Access
Returns a new instance of Access.
12 13 14 15 |
# File 'lib/gitlab/external_authorization/access.rb', line 12 def initialize(user, label) @user = user @label = label end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
6 7 8 |
# File 'lib/gitlab/external_authorization/access.rb', line 6 def label @label end |
#load_type ⇒ Object (readonly)
Returns the value of attribute load_type.
6 7 8 |
# File 'lib/gitlab/external_authorization/access.rb', line 6 def load_type @load_type end |
#loaded_at ⇒ Object (readonly)
Returns the value of attribute loaded_at.
6 7 8 |
# File 'lib/gitlab/external_authorization/access.rb', line 6 def loaded_at @loaded_at end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
6 7 8 |
# File 'lib/gitlab/external_authorization/access.rb', line 6 def reason @reason end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/gitlab/external_authorization/access.rb', line 6 def user @user end |
Instance Method Details
#has_access? ⇒ Boolean
21 22 23 |
# File 'lib/gitlab/external_authorization/access.rb', line 21 def has_access? @access end |
#load! ⇒ Object
25 26 27 28 29 |
# File 'lib/gitlab/external_authorization/access.rb', line 25 def load! load_from_cache load_from_service unless loaded? self end |
#loaded? ⇒ Boolean
17 18 19 |
# File 'lib/gitlab/external_authorization/access.rb', line 17 def loaded? loaded_at && (loaded_at > ExternalAuthorization::Cache::VALIDITY_TIME.ago) end |