debian-mirror-gitlab/lib/gitlab/auth/result.rb
2017-08-17 22:00:37 +05:30

20 lines
446 B
Ruby

module Gitlab
module Auth
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
end
end
end