2019-02-15 15:39:39 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
module Gitlab
|
|
|
|
module Graphql
|
|
|
|
module ExposePermissions
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
prepended do
|
2023-03-04 22:38:38 +05:30
|
|
|
def self.expose_permissions(
|
|
|
|
permission_type,
|
|
|
|
description: 'Permissions for the current user on the resource',
|
|
|
|
&block)
|
2018-11-08 19:23:39 +05:30
|
|
|
field :user_permissions, permission_type,
|
|
|
|
description: description,
|
|
|
|
null: false,
|
2023-03-04 22:38:38 +05:30
|
|
|
method: :itself,
|
|
|
|
&block
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|