palkan/action_policy-graphql

Using Class-level authorization does not work

ofnhwx opened this issue · 1 comments

Tell us about your environment

Ruby Version: 3.3.2

Framework Version (Rails, whatever): Rails 7.1.3.2

Action Policy Version: 0.7.0

Action Policy GraphQL Version: 0.5.4

What did you do?

I tried to set up Class-level authorization according to the following URL.
https://actionpolicy.evilmartians.io/#/graphql?id=class-level-authorization

What did you expect to happen?

We expected it to work as before.

What actually happened?

The following exception occurred at runtime.

undefined method `authorization_targets' for class Class

It has been changed so that build_authorization_context is called when context is passed from outside at action_policy@0.7.0.
However, action_policy-graphql does not define build_authorization_context as an override, so the default implementation is used and authorization_targets is undefined, causing an exception.
palkan/action_policy@v0.6.9...v0.7.0#diff-51799d72042e246a101adf465511a70f8a08779d90c2020e67d8a970b41b9e2a

Thanks for reporting! Fixed and will be released in v0.6.0 soon