Class: Ibrain::Extentions::AuthorizeRequired

Inherits:
GraphQL::Schema::FieldExtension
  • Object
show all
Defined in:
app/graphql/ibrain/extentions/authorize_required.rb

Instance Method Summary collapse

Instance Method Details

#resolve(object:, arguments:, **rest) {|object, arguments, rest| ... } ⇒ Object

Yields:

  • (object, arguments, rest)

Raises:



6
7
8
9
10
11
# File 'app/graphql/ibrain/extentions/authorize_required.rb', line 6

def resolve(object:, arguments:, **rest)
  raise IbrainErrors::PermissionError.new("You not have permission to access #{field&.name}") unless is_authorized(object)

  # yield the current time as `memo`
  yield(object, arguments, rest)
end