Files
acmcc/supabase/migrations/20260327165649_9d1fec5b-3d3a-4a22-ad27-9221b6f9d141.sql
T
2026-06-01 20:19:26 -04:00

16 lines
667 B
SQL

-- Drop and recreate staff policy with WITH CHECK so updates work
DROP POLICY IF EXISTS "Staff can manage elections" ON public.elections;
CREATE POLICY "Staff can manage elections"
ON public.elections
FOR ALL
TO authenticated
USING (has_role(auth.uid(), 'admin'::app_role) OR has_role(auth.uid(), 'manager'::app_role) OR has_role(auth.uid(), 'employee'::app_role))
WITH CHECK (has_role(auth.uid(), 'admin'::app_role) OR has_role(auth.uid(), 'manager'::app_role) OR has_role(auth.uid(), 'employee'::app_role));
-- Also allow anon to SELECT elections for public voting page
CREATE POLICY "Anon can view elections"
ON public.elections
FOR SELECT TO anon
USING (true);