blob: 04f25c53e49d6af900c1bb400c3080d087183b7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module Gitlab
module Graphql
# Allow fields to declare permissions their objects must have. The field
# will be set to nil unless all required permissions are present.
module Authorize
extend ActiveSupport::Concern
def self.use(schema_definition)
schema_definition.instrument(:field, Instrumentation.new)
end
def required_permissions
@required_permissions ||= []
end
def authorize(*permissions)
required_permissions.concat(permissions)
end
end
end
end
|