result.rb 462 Bytes
Newer Older
1 2
module Gitlab
  module Auth
3
    Result = Struct.new(:actor, :project, :type, :authentication_abilities) do
4 5 6 7
      def ci?(for_project)
        type == :ci &&
          project &&
          project == for_project
8 9
      end

10 11 12 13
      def lfs_deploy_token?(for_project)
        type == :lfs_deploy_token &&
          actor &&
          actor.projects.include?(for_project)
14 15
      end

16 17 18 19 20 21
      def success?
        actor.present? || type == :ci
      end
    end
  end
end