01Isolation
Multi-tenant isolation with Row Level Security (RLS)
A company never sees another company's data.
Unlike typical applications that filter data through fallible application queries, FactiPro delegates isolation directly to the underlying PostgreSQL engine. Every table carries a company identifier (business_id) and checks that the user's session belongs to that company.
Even if parameters are tampered with in the browser, the SQL engine rejects any access to records that do not belong to your company.
-- Politique RLS appliquée sur toutes les tables sensibles :
CREATE POLICY "business_member_isolation"
ON public.documents FOR ALL
USING (business_id IN (
SELECT business_id FROM public.business_members
WHERE user_id = auth.uid()
));