Adding a user list with an RPC
We have a user list page, which is supposed to show the users of the same tenant. Now, I’ll show you how you can use a so-called RPC to achieve that aligned with your existing RLS permissions. In Supabase, an RPC is the process of calling a database function outside of the database. Similar to calling .select()
with the Supabase client, calling .rpc()
will allow you to run custom database functions and process their return. We will use this to return the list of users.
Ensuring there are enough users to test
To get started, you should make sure that you have at least two users per tenant to prove that everything is working as expected. Ultimately, if just your name shows up in the list, or you only create users in one specific tenant, then you cannot prove that you’re seeing what you’re supposed to see. So, make sure you have at least four accounts across two different tenants (so, two per tenant).
Once you have your accounts...