mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 04:31:13 -05:00
13 lines
461 B
SQL
13 lines
461 B
SQL
-- 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))
|
|
); |