debian-mirror-gitlab/lib/gitlab/auth/result.rb

29 lines
628 B
Ruby
Raw Normal View History

2018-12-13 13:39:08 +05:30
# frozen_string_literal: true
module Gitlab
2016-09-29 09:46:39 +05:30
module Auth
Result = Struct.new(:actor, :project, :type, :authentication_abilities) do
2019-12-04 20:38:33 +05:30
prepend_if_ee('::EE::Gitlab::Auth::Result') # rubocop: disable Cop/InjectEnterpriseEditionModule
2016-09-29 09:46:39 +05:30
def ci?(for_project)
type == :ci &&
project &&
project == for_project
end
def lfs_deploy_token?(for_project)
type == :lfs_deploy_token &&
2017-08-17 22:00:37 +05:30
actor.try(:has_access_to?, for_project)
2016-09-29 09:46:39 +05:30
end
def success?
actor.present? || type == :ci
end
2017-09-10 17:25:29 +05:30
def failed?
!success?
end
2016-09-29 09:46:39 +05:30
end
end
end