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
15
# File 'lib/gitlab/external_authorization/access.rb', line 12

def initialize(user, label)
  @user = user
  @label = 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)


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

Returns:

  • (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