From eeb84725c648af3c8ff5b27595a453b9c8ea3b4a Mon Sep 17 00:00:00 2001 From: patrickwebsdev Date: Thu, 7 Nov 2024 21:56:20 -0300 Subject: [PATCH] fix: update policy on auth user email only --- ...8005004_add_help_requests_policy_update_with_email.sql | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 supabase/migrations/20241108005004_add_help_requests_policy_update_with_email.sql diff --git a/supabase/migrations/20241108005004_add_help_requests_policy_update_with_email.sql b/supabase/migrations/20241108005004_add_help_requests_policy_update_with_email.sql new file mode 100644 index 00000000..28d38570 --- /dev/null +++ b/supabase/migrations/20241108005004_add_help_requests_policy_update_with_email.sql @@ -0,0 +1,8 @@ +alter policy "Enable update for users based on email" +on "public"."help_requests" +to public +using ( + ((auth.uid() IS NOT NULL) AND ((additional_info ->> 'email'::text) = auth.email())) +with check ( + ((auth.uid() IS NOT NULL) AND ((additional_info ->> 'email'::text) = auth.email())) +); \ No newline at end of file