-- 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() ) );