RLS with a join table

I can't for the life of me figure this one out 🤦‍♂️

I have a table of for lists and a table for user_list_relations. The user_list_relations table is joined with the lists table via the list_id.

The user_list_relations table also has a column called user_profile_id which match the auth.uid().

I need to setup RLS so that a user can read, instert, update, or delete a list if they have a user_list_relation for that list.

I'm assuming the correct order of operations when creating a new list is:

  1. Insert a new row for the list
  2. Create the user_list_relation using the list_id from the list that was just created.
But, I'm not sure how this all comes together with RLS.

Let me know what additional info I can provide. Thanks!
Was this page helpful?