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>
40 lines
1.1 KiB
SQL
40 lines
1.1 KiB
SQL
|
|
-- Allow board members to read financial data for associations they serve on the board for.
|
|
-- This powers the board "Financial Overview" page.
|
|
|
|
CREATE POLICY "Board members can view association bank accounts"
|
|
ON public.bank_accounts FOR SELECT
|
|
TO authenticated
|
|
USING (
|
|
association_id IN (
|
|
SELECT bm.association_id FROM public.board_members bm WHERE bm.user_id = auth.uid()
|
|
)
|
|
);
|
|
|
|
CREATE POLICY "Board members can view association bank transactions"
|
|
ON public.bank_transactions FOR SELECT
|
|
TO authenticated
|
|
USING (
|
|
association_id IN (
|
|
SELECT bm.association_id FROM public.board_members bm WHERE bm.user_id = auth.uid()
|
|
)
|
|
);
|
|
|
|
CREATE POLICY "Board members can view association collections"
|
|
ON public.collections FOR SELECT
|
|
TO authenticated
|
|
USING (
|
|
association_id IN (
|
|
SELECT bm.association_id FROM public.board_members bm WHERE bm.user_id = auth.uid()
|
|
)
|
|
);
|
|
|
|
CREATE POLICY "Board members can view association owner ledger entries"
|
|
ON public.owner_ledger_entries FOR SELECT
|
|
TO authenticated
|
|
USING (
|
|
association_id IN (
|
|
SELECT bm.association_id FROM public.board_members bm WHERE bm.user_id = auth.uid()
|
|
)
|
|
);
|