9b65d4bb41
- All definitions have been replaced by classes: http://graphql-ruby.org/schema/class_based_api.html - Authorization & Presentation have been refactored to work in the class based system - Loaders have been replaced by resolvers - Times are now coersed as ISO 8601
21 lines
541 B
Ruby
21 lines
541 B
Ruby
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
|