How to allow only one action and forbid all others by default in policy?
From the doc when multiple policies apply to the same request, all applicable policies must pass for the action to be authorized.
I have a policy for the :profile read action, that is available only for the current actor:
I want all the other actions to be forbidden by default. How can I achieve that? I tried this, but in that case I won't be able to reach the :profile action.
I suspect that instead of having a policy, I should have a
bypass
on the profile
action right?Solution:Jump to solution
forbid is the default, if no policy block applies to the action, so you can just remove this one
```elixir
policy always() do
forbid_if always()...
3 Replies