I’m working on authorization, and I’m looking to implement Ash Policies. My authorization system consists of three main resources:
User
Permission
with primary attributes (name, resource)UserPermission
My setup involves users having many permissions through UserPermission
.
I’ve written a function to check if a user has permission to perform an action on a resource. However, I’m encountering an error: undefined function can?/3 (there is no such import).
Here’s the policy in the Category resource:
policies do
policy action_type(:read) do
authorize_if can?(:actor, :read, :resource)
end
end
How can I resolve this issue, or what’s the best approach to achieve this using Ash?