platformOS Community

Tip: stacking authorization policies

Rich - One Orange Cow Jun 29 2021 at 01:34

Not a question .... Tip that might help someone reduce bloat.

If you are stacking auth policies (multiple for a page) and you want to reuse an existing auth policy that has a redirect on failure and don't want to create a second one or have some sort of include... you can put something in the metadata for the page to tell the auth policy to redirect or not. Because the page renders first it will pass this info upto the auth policy...

Auth policy:

name: policy1_redirect_disabled
redirect_to: >
  {%- if != true -%} /login {%- endif -%}


- policy1_redirect_disabled
- policy2_has_redirect
  admin_redirect_disabled: true
Please sign in or fill up your profile to answer a question