2016-09-19 07:42:10 -04:00
|
|
|
module Gitlab
|
|
|
|
module Auth
|
2016-09-19 08:23:18 -04:00
|
|
|
Result = Struct.new(:actor, :project, :type, :authentication_abilities) do
|
2016-09-20 04:24:47 -04:00
|
|
|
def ci?(for_project)
|
|
|
|
type == :ci &&
|
|
|
|
project &&
|
|
|
|
project == for_project
|
2016-09-19 07:42:10 -04:00
|
|
|
end
|
|
|
|
|
2016-09-20 04:24:47 -04:00
|
|
|
def lfs_deploy_token?(for_project)
|
|
|
|
type == :lfs_deploy_token &&
|
2016-11-16 07:31:08 -05:00
|
|
|
actor.try(:has_access_to?, for_project)
|
2016-09-19 10:34:32 -04:00
|
|
|
end
|
|
|
|
|
2016-09-19 07:42:10 -04:00
|
|
|
def success?
|
|
|
|
actor.present? || type == :ci
|
|
|
|
end
|
2017-05-31 09:55:12 -04:00
|
|
|
|
|
|
|
def failed?
|
|
|
|
!success?
|
|
|
|
end
|
2016-09-19 07:42:10 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|