2018-12-23 12:14:25 +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
|
|
|
|
def self.expose_permissions(permission_type, description: 'Permissions for the current user on the resource')
|
|
|
|
field :user_permissions, permission_type,
|
|
|
|
description: description,
|
|
|
|
null: false,
|
|
|
|
resolve: -> (obj, _, _) { obj }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|