Erwin
02/21/2022, 7:23 PMcontributors
table that maps user_id
to document_id
Two solutions I have so far:
1. Define policies that perform joins to find the document_id
and check that the user is a contributor of the document. At the deepest level, this is a join across 5 tables (4 levels + contributors table) within RLS policies.
2. Keep a document_id
column for entities at each level of the hierarchy, since that value will never change after creation anyways. Breaks normalization, but RLS policies become very simple & efficient.
So far, I'm leaning towards 2. but would love input from people with more experience!silentworks
02/21/2022, 7:40 PMdocument_id
will never change after creation, if it does otherwise you might have some maintenance burden.Erwin
02/21/2022, 7:44 PMsilentworks
02/21/2022, 7:45 PM