Skip to content

Releases: palkan/action_policy-graphql

0.5.0

07 Oct 11:30
Compare
Choose a tag to compare

Features

New configuration options to control exceptions behaviour

Two new configuration options have been added:

  • preauthorize_raise_exception: similar to authorize_raise_exception but for preauthorize: true fields; fallbacks to authorize_raise_exception unless explicitly specified.

  • preauthorize_mutation_raise_exception: similar to preauthorize_raise_exception but only for mutations; fallbacks to preauthorize_raise_exception unless explicitly specified.

By defining this options you can, for example, configure Action Policy to return nulls for queries and raise exceptions for mutation fields when using authorize: * and preauthorize: * options:

# The default value for all authorize: * fields
ActionPolicy::GraphQL.authorize_raise_exception = true
# The default value for all preauthorize: * fields
ActionPolicy::GraphQL.preauthorize_raise_exception = false
# Override preauthorize: * behaviour for mutations
ActionPolicy::GraphQL.preauthorize_raise_exception = true

Specify custom field options for expose_authorization_rules

Now you can add additional options for underflying field call via field_options parameter:

expose_authorization_rules :show?, field_options: {camelize: false}

# equals to
field :can_show, ActionPolicy::GraphQL::Types::AuthorizationResult, null: false, camelize: false

0.2.0

18 Aug 16:25
Compare
Choose a tag to compare

0.1.0

21 May 01:46
Compare
Choose a tag to compare

Initial version.

📑 Documentation