From 34d700f2f4831262fc47c69fd88775b3a99aec5c Mon Sep 17 00:00:00 2001 From: Arthur Belleville Date: Wed, 9 Jul 2025 08:01:32 +0200 Subject: [PATCH] Fix policy --- sql/14_create_events_table.sql | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/sql/14_create_events_table.sql b/sql/14_create_events_table.sql index b88ed67..da42aa8 100644 --- a/sql/14_create_events_table.sql +++ b/sql/14_create_events_table.sql @@ -73,22 +73,7 @@ CREATE POLICY "Users can update their own events in accessible tablos" ON events AND EXISTS ( SELECT 1 FROM user_tablos ut JOIN events ON ut.id = events.tablo_id - WHERE events.deleted_at IS NULL - AND ( - ut.user_id = (SELECT auth.uid()) - ) - ) - ); - --- Policy to allow users to delete their own events in accessible tablos -CREATE POLICY "Users can delete their own events in accessible tablos" ON events - FOR DELETE USING ( - created_by = (SELECT auth.uid()) - AND EXISTS ( - SELECT 1 FROM user_tablos ut - JOIN events ON ut.id = events.tablo_id - WHERE events.deleted_at IS NULL - AND ( + WHERE ( ut.user_id = (SELECT auth.uid()) ) )