Class: Gitlab::ExternalAuthorization::Access

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/external_authorization/access.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, label) ⇒ Access

Returns a new instance of Access.


12
13
14
# File 'lib/gitlab/external_authorization/access.rb', line 12

def initialize(user, label)
  @user, @label = user, label
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label


6
7
8
# File 'lib/gitlab/external_authorization/access.rb', line 6

def label
  @label
end

#load_typeObject (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_atObject (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

#reasonObject (readonly)

Returns the value of attribute reason


6
7
8
# File 'lib/gitlab/external_authorization/access.rb', line 6

def reason
  @reason
end

#userObject (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

Returns:

  • (Boolean)

20
21
22
# File 'lib/gitlab/external_authorization/access.rb', line 20

def has_access?
  @access
end

#load!Object


24
25
26
27
28
# File 'lib/gitlab/external_authorization/access.rb', line 24

def load!
  load_from_cache
  load_from_service unless loaded?
  self
end

#loaded?Boolean

Returns:

  • (Boolean)

16
17
18
# File 'lib/gitlab/external_authorization/access.rb', line 16

def loaded?
  loaded_at && (loaded_at > ExternalAuthorization::Cache::VALIDITY_TIME.ago)
end