Class: Gitlab::Auth::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/gitlab/auth/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actorObject

Returns the value of attribute actor

Returns:

  • (Object)

    the current value of actor


5
6
7
# File 'lib/gitlab/auth/result.rb', line 5

def actor
  @actor
end

#authentication_abilitiesObject

Returns the value of attribute authentication_abilities

Returns:

  • (Object)

    the current value of authentication_abilities


5
6
7
# File 'lib/gitlab/auth/result.rb', line 5

def authentication_abilities
  @authentication_abilities
end

#projectObject

Returns the value of attribute project

Returns:

  • (Object)

    the current value of project


5
6
7
# File 'lib/gitlab/auth/result.rb', line 5

def project
  @project
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type


5
6
7
# File 'lib/gitlab/auth/result.rb', line 5

def type
  @type
end

Instance Method Details

#ci?(for_project) ⇒ Boolean

Returns:

  • (Boolean)

6
7
8
9
10
# File 'lib/gitlab/auth/result.rb', line 6

def ci?(for_project)
  type == :ci &&
    project &&
    project == for_project
end

#failed?Boolean

Returns:

  • (Boolean)

21
22
23
# File 'lib/gitlab/auth/result.rb', line 21

def failed?
  !success?
end

#lfs_deploy_token?(for_project) ⇒ Boolean

Returns:

  • (Boolean)

12
13
14
15
# File 'lib/gitlab/auth/result.rb', line 12

def lfs_deploy_token?(for_project)
  type == :lfs_deploy_token &&
    actor.try(:has_access_to?, for_project)
end

#success?Boolean

Returns:

  • (Boolean)

17
18
19
# File 'lib/gitlab/auth/result.rb', line 17

def success?
  actor.present? || type == :ci
end