SQL Editor - Emulate auth.uid() #8556
Unanswered
jhegele
asked this question in
Feature Requests
Replies: 1 comment
|
This shows an example of setting up to emulate a user... |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hoping someone can point out that this is already a feature but, if it's not, it would be handy to add. In my app, I'm using RLS to secure underlying tables and using views to expose a subset of data from the tables. As an example, imagine a table of user profiles where the user can choose to make his/her profile public and I want to protect certain private columns like phone number or full name across all users. I build the view such that it never pulls the private columns (phone number and full name) and I restrict the rows to rows that are public or are owned by the currently authenticated user.
In general, this approach works well for me but as I continue to build my app, I have some situations where I am building a new view that is dependent upon another view. It's challenging to test in the Supabase UI because I cannot force the UI to emulate a logged in user in the SQL Editor. So, when I run my query to test it always shows no rows returned which, based on the rules I've put in place, is accurate as I am not actively logged into my app. Would love someway to specify that I want to run a query as a specific user ID and see the results.
All reactions