Why my policy is always blocking the function call?
I want to add a policy to only accept calling the
confirm
(ash authentication email confirmation action) action when the actor confirmed_at
is nil
.
To do that, I added:
But, if when I send the actor, it has the field as nil
, it will still be blocked by the second policy.
Any ideas why?3 Replies
Any check that references the actor will evaluate to false if there is no actor.
Oh, but that’s not your problem.
There is no check that will set that policy to an authorized status
Forbid unless can forbid the policy, but if we get to the end of the checks and nothing has made it authorized, then it will be forbidden
You probably want something like
authorize_if …
there.
What exactly are you trying to accomplish with that policy?Ah, I see, so basically something like this:
Basically I don't want this call to be accessible after the user already confirmed his email
Doing that way worked great, thanks, now it makes sense. I thought it would just go straight to the last policy.
Yeah, and you want a check in here that the actor is the same as the user in question, BTW