mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-27 09:06:59 -05:00
Fix: Re-add RLS policy for user profiles
This commit is contained in:
@@ -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.';
|
||||
Reference in New Issue
Block a user