lib/graphql_role_restrict.rb
#
# Check the validatity of the the role_restrict value against an object representing
# the current_user stored in context[:current_user]
# (injection of that value has to be done at the controller level before accessing graphql code)
#
# Method NEEDS to be Overwritten once the module is included in your Argument/Field class to allow
# custom logic
#
# @param [GraphQL::Query::Context] context Graphql context object
# @param [Any] role_restrict Any value passed in to a role_restrict option of a field / argument
#
# @return [Boolean]
#
Check the validatity of the the role_restrict value against an object representing
the current_user stored in context[:current_user]
(injection of that value has to be done at the controller level before accessing graphql code)

Method NEEDS to be Overwritten once the module is included in your Argument/Field class to allow
custom logic
Check the validatity of the the role_restrict value against an object representing the current_user stored in context [ : current_user ] ( injection of that value has to be done at the controller level before accessing graphql code ) Method NEEDS to be Overwritten once the module is included in your Argument / Field class to allow custom logic
def context_role_valid?(context, role_restrict)
    case role_restrict
    when :logged_in
      !!context[:current_user]
    else
      true
    end
  end
def context_role_valid? ( context , role_restrict ) case role_restrict when :logged_in ! ! context [ :current_user ] else true end end
Check the validatity of the the role_restrict value against an object representing
the current_user stored in context[:current_user]
(injection of that value has to be done at the controller level before accessing graphql code)
Check the validatity of the the role_restrict value against an object representing the current_user stored in context [ : current_user ] ( injection of that value has to be done at the controller level before accessing graphql code )
None
Boolean
context
<not_specific>
role_restrict
<not_specific>
<not_specific>
role_restrict Any value passed in to a role_restrict option of a field / argument
role_restrict Any value passed in to a role_restrict option of a field / argument