palkan/action_policy-graphql

initializer to set defaults of query and mutations

lifeiscontent opened this issue · 0 comments

In GraphQL is often preferred to return nil if you're unauthorized to view something.

and only raise an error in a mutation.

I'd like to have a feature

that works like something along the lines of

config/initializers/action_policy.rb

ActionPolicy::GraphQL.configure do |config|
  config.defaults.mutation.authorize.raise = true
  config.defaults.mutation.preauthorize.raise = true
  config.defaults.query.authorize.raise = false
  config.defaults.query.preauthorize.raise = false
end

to set the defaults of how ActionPolicy works in GraphQL