summaryrefslogtreecommitdiff
path: root/lib/gitlab/graphql/expose_permissions.rb
blob: ab9ed354673a6667c4255fdb7aedf9edd35ded2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 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')
          field :user_permissions, permission_type,
                description: description,
                null: false,
                method: :itself
        end
      end
    end
  end
end