add delete_user_rls to user table

This commit is contained in:
Hongbo Wu
2022-07-13 16:06:40 +08:00
parent 3c764776ef
commit fdd9b10bf0
3 changed files with 21 additions and 1 deletions

View File

@ -4,6 +4,6 @@
BEGIN;
-- do nothing here, there's no reason to undo this migration.
REVOKE DELETE ON omnivore.user FROM omnivore_user;
COMMIT;

View File

@ -0,0 +1,11 @@
-- Type: DO
-- Name: grant_delete_rls_on_users
-- Description: Add RLS delete permission to the users table
BEGIN;
CREATE POLICY delete_users on omnivore.user
FOR DELETE TO omnivore_user
USING (id = omnivore.get_current_user_id());
COMMIT;

View File

@ -0,0 +1,9 @@
-- Type: UNDO
-- Name: grant_delete_rls_on_users
-- Description: Add RLS delete permission to the users table
BEGIN;
DROP POLICY delete_users ON omnivore.user;
COMMIT;