From 9471d25939344130cb40e20624aff7228c7e5825 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Thu, 9 Oct 2025 12:09:04 +0000 Subject: [PATCH] Fix: Re-add RLS policy for user profiles --- ...0848_dc342324-4aba-458f-b42a-da94db85e5d6.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 supabase/migrations/20251009120848_dc342324-4aba-458f-b42a-da94db85e5d6.sql diff --git a/supabase/migrations/20251009120848_dc342324-4aba-458f-b42a-da94db85e5d6.sql b/supabase/migrations/20251009120848_dc342324-4aba-458f-b42a-da94db85e5d6.sql new file mode 100644 index 00000000..2c5b4cda --- /dev/null +++ b/supabase/migrations/20251009120848_dc342324-4aba-458f-b42a-da94db85e5d6.sql @@ -0,0 +1,16 @@ +-- Fix: Re-add the missing RLS policy for users to view their own profiles +-- This is critical for the useAuth hook to function properly + +-- Allow users to view their own complete profile from the profiles table +-- This was accidentally removed in the previous migration +CREATE POLICY "Users can view their own profiles" +ON public.profiles +FOR SELECT +TO authenticated +USING (auth.uid() = user_id); + +-- Add comment +COMMENT ON POLICY "Users can view their own profiles" ON public.profiles IS +'Allows users to view their own complete profile from the profiles table. +This is essential for the useAuth hook and profile editing functionality. +For viewing other users profiles, use the filtered_profiles view which enforces privacy controls.'; \ No newline at end of file