jaf
01/12/2022, 2:38 PMproducts
table. The products
table has a supplier_id
field that references the suppliers
table. The suppliers
table has a user_id
field that references the user. The RLS policy fo the suppliers table is very simple: (uid() = user_id)
. But I struggle to create the more complex policy required to protect the products
based on that relationship.jason-lynx
01/13/2022, 9:27 AMsuppliers
, then i think the products
policy only needs to be (supplier_id IN (SELECT id FROM suppliers))
if not, then the slightly longer (supplier_id IN (SELECT s.id FROM suppliers s WHERE s.user_id = uid()))
should workjaf
01/13/2022, 1:06 PMjaf
01/13/2022, 2:21 PMsupabase.auth.setAuth(cookies.access_token)
solved the problem