Skip to content

Instantly share code, notes, and snippets.

@cazzer
Last active August 2, 2018 05:12
Show Gist options
  • Save cazzer/f66d8e1419ffc3bd2e5786f724292106 to your computer and use it in GitHub Desktop.
Save cazzer/f66d8e1419ffc3bd2e5786f724292106 to your computer and use it in GitHub Desktop.
create policy item_owner
on items
as permissive
for all
to application_user
using (
items.acl_read && regexp_split_to_array(current_setting('jwt.claims.roles'), ',')::uuid[]
or items.acl_write && regexp_split_to_array(current_setting('jwt.claims.roles'), ',')::uuid[]
)
with check (
items.acl_write && regexp_split_to_array(current_setting('jwt.claims.roles'), ',')::uuid[]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment