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

22 lines
462 B
Ruby
Raw Normal View History

2016-09-29 09:46:39 +05:30
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 &&
actor.projects.include?(for_project)
end
def success?
actor.present? || type == :ci
end
end
end
end