summaryrefslogtreecommitdiff
path: root/lib/gitlab/graphql/expose_permissions.rb
blob: 070d3c188a46921cc9f7009613a1d2406bae5aab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module Gitlab
  module Graphql
    module ExposePermissions
      extend ActiveSupport::Concern
      prepended do
        def self.expose_permissions(
          permission_type,
          description: 'Permissions for the current user on the resource',
          &block)
          field :user_permissions, permission_type,
                description: description,
                null: false,
                method: :itself,
                &block
        end
      end
    end
  end
end