how do you change supabase user role? i basically ...
# help
m
how do you change supabase user role? i basically want to assign some admins so they can fetch all records while users have access only to those created by them
s
You should do this in your own tables, don't modify the postgres user roles. You would create a table called
roles
and do all your permission stuff in there and then use Postgres Row Level Security (RLS) to allow access based on the
roles
table.
m
ah, so like this, more or less
Copy code
((uid() = added_by) OR ( SELECT (profiles.id = uid()) FROM profiles))
i see, but what is the use of users.role then?
since only authorized user has authenticated role it seems kinda obselote field
s
It is used by supabase itself, you shouldn't modify anything in the
auth
schema, so
auth.users
role
is not something you want to mess with.
m
can i see error codes anywhere? message i get in error doesn't help me in any way
s
No there isn't a list of error codes anywhere, it has been discussed with the Supabase team that it would be good to have some useful error codes along with a reference to them