hi team. i would like to hide and show columns bas...
# help
l
hi team. i would like to hide and show columns based on user preferences.. for example Settings - id - name Preferences - show name field: false How can i prevent users from querying the name column based on my preferences?
n
Hello @lanbau! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! 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.
r
Are we talking about columns in the table itself? or in the supabase UI? If it's in the table itself, you could use a view by user:
CREATE OR REPLACE VIEW settings_my_user_id AS (SELECT id, name FROM settings);
n
lanbau (2022-05-25)
l
columns in the table itself. yes i have thought of that.. but it will be multiple columns.. which means i have to create multiple views for enabled/disabled column
view 1 -> id view 2 -> id, name view 3 -> id, name, age view 4 -> id, age For example
g
You could also call the table thru an rpc function and send back only columns that you want.
l
can the rpc function check for the caller's identity like RLS
g
RLS is just a where statement added to the query. You can either do if statements using jwt role or other user jwt data, or sql to lookup table results using auth.uid().