gitlab-org--gitlab-foss/lib/gitlab/auth/result.rb

25 lines
527 B
Ruby
Raw Normal View History

module Gitlab # rubocop:disable Naming/FileName
module Auth
2016-09-19 08:23:18 -04:00
Result = Struct.new(:actor, :project, :type, :authentication_abilities) do
def ci?(for_project)
type == :ci &&
project &&
project == for_project
end
def lfs_deploy_token?(for_project)
type == :lfs_deploy_token &&
actor.try(:has_access_to?, for_project)
end
def success?
actor.present? || type == :ci
end
def failed?
!success?
end
end
end
end