-- ============================================
-- 此文件由 Meoo Cloud 自动生成，请勿修改
-- This file is auto-generated by Meoo Cloud, DO NOT MODIFY
-- ============================================

ALTER TABLE public.accounts_payable ENABLE ROW LEVEL SECURITY; ALTER TABLE public.accounts_payable_items ENABLE ROW LEVEL SECURITY; CREATE POLICY purchaser_select_ap ON public.accounts_payable FOR SELECT USING (purchaser_id = get_user_master_company_id()); CREATE POLICY textile_select_ap ON public.accounts_payable FOR SELECT USING (textile_factory_id = get_user_master_company_id()); CREATE POLICY purchaser_insert_ap ON public.accounts_payable FOR INSERT WITH CHECK (purchaser_id = get_user_master_company_id()); CREATE POLICY purchaser_update_ap ON public.accounts_payable FOR UPDATE USING (purchaser_id = get_user_master_company_id()); CREATE POLICY purchaser_select_ap_items ON public.accounts_payable_items FOR SELECT USING (EXISTS (SELECT 1 FROM public.accounts_payable ap WHERE ap.id = accounts_payable_items.accounts_payable_id AND ap.purchaser_id = get_user_master_company_id())); CREATE POLICY textile_select_ap_items ON public.accounts_payable_items FOR SELECT USING (EXISTS (SELECT 1 FROM public.accounts_payable ap WHERE ap.id = accounts_payable_items.accounts_payable_id AND ap.textile_factory_id = get_user_master_company_id())); CREATE POLICY purchaser_insert_ap_items ON public.accounts_payable_items FOR INSERT WITH CHECK (EXISTS (SELECT 1 FROM public.accounts_payable ap WHERE ap.id = accounts_payable_items.accounts_payable_id AND ap.purchaser_id = get_user_master_company_id())); CREATE POLICY purchaser_update_ap_items ON public.accounts_payable_items FOR UPDATE USING (EXISTS (SELECT 1 FROM public.accounts_payable ap WHERE ap.id = accounts_payable_items.accounts_payable_id AND ap.purchaser_id = get_user_master_company_id()));
