mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
183fe0a93c
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
43 lines
1.1 KiB
SQL
43 lines
1.1 KiB
SQL
|
|
UPDATE storage.buckets SET public = false WHERE id = 'invoices';
|
|
|
|
CREATE POLICY "Staff can read invoices"
|
|
ON storage.objects FOR SELECT TO authenticated
|
|
USING (
|
|
bucket_id = 'invoices'
|
|
AND (
|
|
public.has_role(auth.uid(), 'admin'::public.app_role)
|
|
OR public.has_role(auth.uid(), 'manager'::public.app_role)
|
|
)
|
|
);
|
|
|
|
CREATE POLICY "Staff can upload invoices"
|
|
ON storage.objects FOR INSERT TO authenticated
|
|
WITH CHECK (
|
|
bucket_id = 'invoices'
|
|
AND (
|
|
public.has_role(auth.uid(), 'admin'::public.app_role)
|
|
OR public.has_role(auth.uid(), 'manager'::public.app_role)
|
|
)
|
|
);
|
|
|
|
CREATE POLICY "Staff can update invoices"
|
|
ON storage.objects FOR UPDATE TO authenticated
|
|
USING (
|
|
bucket_id = 'invoices'
|
|
AND (
|
|
public.has_role(auth.uid(), 'admin'::public.app_role)
|
|
OR public.has_role(auth.uid(), 'manager'::public.app_role)
|
|
)
|
|
);
|
|
|
|
CREATE POLICY "Staff can delete invoices"
|
|
ON storage.objects FOR DELETE TO authenticated
|
|
USING (
|
|
bucket_id = 'invoices'
|
|
AND (
|
|
public.has_role(auth.uid(), 'admin'::public.app_role)
|
|
OR public.has_role(auth.uid(), 'manager'::public.app_role)
|
|
)
|
|
);
|