Trying to create new roles to query against them w...
# sql
d
Trying to create new roles to query against them with RLS, GRANT new_role to authenticator after granting "new_role" to authenticator how would we go to actually assign this "new_role" role to a specific user in auth.users instead of the current "authenticated" role, I tried update auth.users set role = 'new role' but it does not work with RLS when trying to access auth.role() = 'new role'
s
Please don't do it this way, what you should do is create your own roles table and setup your RLS rules against that, you can do normal SQL queries inside of the RLS rules. This discussion touches on this a bit https://github.com/supabase/supabase/discussions/811
d
Ok, I get you, so basically not touch the roles
keep the default and just add new roles to table and normal sql query
s
Correct. you can then setup RLS based on that table to check the user's role
d
Yeah more simplistic, should we restrain from using in general ROLES and Grant privileges with web apps ?
s
Not sure I understand your question
d
never mind, thanks that answers it!