Class: Groovestack::Auth::GraphQL::AuthorizedField

Inherits:
Base::GraphQL::Base::Field
  • Object
show all
Defined in:
lib/groovestack/auth/graphql/authorized_field.rb

Instance Method Summary collapse

Instance Method Details

#authorized?(obj, args, ctx) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
# File 'lib/groovestack/auth/graphql/authorized_field.rb', line 7

def authorized?(obj, args, ctx)
  authorized_fields = begin
    obj.authorized_fields_for_serialization(ctx[:current_user])
  rescue StandardError
    []
  end

  super && authorized_fields.include?(name.to_sym)
end