Having some trouble with a custom policy
Hi! I'm using a custom policy like this:
and then I have:
However even with this policy with everything set to true, the match? is failing. And my logs aren't showing up.
If I delete the policy, it does what I expect (allow even non paying users through). But adding the policy makes it forbid every user
5 Replies
Oh nm I figured it out. I thought the policies would "stack" so if I had
then that would also get executed. But it seems like maybe the most specific one gets executed?
All policies that apply have to pass
The issue is that a
forbid_unless
being the inly check in a policy has no possibility of passing
So the solver didnt bother running the check
You’d need to add an authorize_if
or an authorize_unless
somewhere below it for that to make sensehmm I had this:
so I was expecting the action policy for request generation to get run, and then the action type policy for update to also get run. But it seems like only one block will run
All blocks with a matching condition need to return
authorized
for an action to be alowed. Therefore if the first one already returns :unknown
or :forbidden
there is no need to check the others.
you could add authorize_if always()
at the end of your :request_generation
block then it would check the next block because the first one would authorize and the other blocks needs to be evaluated because the condition matchesah I see
thanks!