mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:31:12 -05:00
Refactor: Simplify RLS for Realtime
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
-- Drop existing complex SELECT policies that cause Realtime timeouts
|
||||
DROP POLICY IF EXISTS "Moderators can view all content submissions" ON public.content_submissions;
|
||||
DROP POLICY IF EXISTS "Users can view their own submissions" ON public.content_submissions;
|
||||
|
||||
DROP POLICY IF EXISTS "Moderators can view all submission items" ON public.submission_items;
|
||||
DROP POLICY IF EXISTS "Users can view their own submission items" ON public.submission_items;
|
||||
|
||||
DROP POLICY IF EXISTS "Moderators can view all reports" ON public.reports;
|
||||
DROP POLICY IF EXISTS "Users can view their own reports" ON public.reports;
|
||||
|
||||
DROP POLICY IF EXISTS "Moderators can view all reviews" ON public.reviews;
|
||||
DROP POLICY IF EXISTS "Users can view their own reviews" ON public.reviews;
|
||||
DROP POLICY IF EXISTS "Public read access to approved reviews" ON public.reviews;
|
||||
|
||||
-- Create simplified SELECT policies for Realtime (app-level authorization handles access control)
|
||||
CREATE POLICY "Allow authenticated users to view content submissions"
|
||||
ON public.content_submissions
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (true);
|
||||
|
||||
CREATE POLICY "Allow authenticated users to view submission items"
|
||||
ON public.submission_items
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (true);
|
||||
|
||||
CREATE POLICY "Allow authenticated users to view reports"
|
||||
ON public.reports
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (true);
|
||||
|
||||
CREATE POLICY "Allow authenticated users to view reviews"
|
||||
ON public.reviews
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (true);
|
||||
Reference in New Issue
Block a user