Welcome to mirror list, hosted at ThFree Co, Russian Federation.

expose_permissions.rb « graphql « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
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