class GraphQR::PermittedFieldsExtension

This is an extension used on the GraphQR::Fields::BaseField.

It is responsible for authorizing each field within a query. It searches if the field is defined on the permitted_fields method of the policy

Public Instance Methods

resolve(object:, arguments:, context:) { |object, arguments, nil| ... } click to toggle source
# File lib/graphqr/permitted_fields_extension.rb, line 10
def resolve(object:, arguments:, context:)
  if authorized?(object, context)
    yield(object, arguments, nil)
  else
    on_unauthorized
  end
end