Ash FrameworkAF
Ash Framework8mo ago
40 replies
ggarciajr

Weird policy behavior

Given the following policy:
    policy action_type(:read) do
      forbid_if expr(is_nil(^actor(:organization_id)))
      authorize_if expr(id == ^actor(:organization_id))
    end


I'd expect the call to MyDomain.can_get_by_id?(user, resource) to return false when user.organization_id == nil but I'm getting a truthy value back.

What I'm doing wrong?
Solution
No, the way you're doing it makes sense.
Was this page helpful?