BigW Consortium Gitlab

result.rb 446 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
      def lfs_deploy_token?(for_project)
        type == :lfs_deploy_token &&
12
          actor.try(:has_access_to?, for_project)
13 14
      end

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