Anyone have advice on the best setup for multiple ...
# help
b
Anyone have advice on the best setup for multiple authenticated users having access to the same row when using RLS on a table? Do you just store an array of UUIDs in the record and then test to see if the array contains the UUID on request?
n
Hello ! This thread has been automatically created from your message in a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
b
There are lots of examples of 1:1, row:uuid security, but I haven't found one for 1:n row:uuids.
g
You could use an array, or I like to use a "member" table that is just pairs of member id's with the id of the thing they have access to. For me that is chat rooms (which are a row).
n
Bryan K. (2022-03-25)
b
Do you enable RLS for the table and then handle the check for the data table in a Supabase DB Function?
g
The RLS would look up in the member table for a uid match with the row id.
b
I see, then return the results from the 'rooms' table that the member table pairs the UUID with.
b
@User this is perfect thank you!
n
Thread was archived by @Bryan K.. Anyone can send a message to unarchive it.