mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 09:50:01 +00:00
Add ACMCC app source, Supabase backend, and project config
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
|
||||
-- Fix SELECT: staff see all, others see only their associations
|
||||
DROP POLICY IF EXISTS "Authenticated users can read active announcements" ON public.announcements;
|
||||
CREATE POLICY "Authenticated users can read scoped announcements" ON public.announcements
|
||||
FOR SELECT TO authenticated
|
||||
USING (
|
||||
status = 'active' AND (
|
||||
public.has_role(auth.uid(), 'admin') OR
|
||||
public.has_role(auth.uid(), 'manager') OR
|
||||
public.has_role(auth.uid(), 'employee') OR
|
||||
association_id IN (SELECT public.get_user_association_ids())
|
||||
)
|
||||
);
|
||||
|
||||
-- Fix UPDATE: restrict to staff
|
||||
DROP POLICY IF EXISTS "Authors can update their announcements" ON public.announcements;
|
||||
CREATE POLICY "Staff can update announcements" ON public.announcements
|
||||
FOR UPDATE TO authenticated
|
||||
USING (public.has_role(auth.uid(), 'admin') OR public.has_role(auth.uid(), 'manager'));
|
||||
|
||||
-- Fix DELETE: restrict to staff
|
||||
DROP POLICY IF EXISTS "Authors can delete their announcements" ON public.announcements;
|
||||
CREATE POLICY "Staff can delete announcements" ON public.announcements
|
||||
FOR DELETE TO authenticated
|
||||
USING (public.has_role(auth.uid(), 'admin') OR public.has_role(auth.uid(), 'manager'));
|
||||
Reference in New Issue
Block a user