mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 12:31:26 -05:00
Fix profile viewing policy
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
-- Drop the restrictive authenticated-only policy
|
||||||
|
DROP POLICY IF EXISTS "Authenticated users can view profiles" ON public.profiles;
|
||||||
|
|
||||||
|
-- Create a new policy that allows both anonymous and authenticated users to view public profiles
|
||||||
|
CREATE POLICY "Public can view non-banned public profiles"
|
||||||
|
ON public.profiles
|
||||||
|
FOR SELECT
|
||||||
|
TO anon, authenticated
|
||||||
|
USING (
|
||||||
|
(auth.uid() = user_id)
|
||||||
|
OR is_moderator(auth.uid())
|
||||||
|
OR ((privacy_level = 'public') AND (NOT banned))
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user