Roles Issue - supabase

Hey !

I have an issue with roles

Here it is : in the app i’m working on, i have admins and users roles

I used the tutorial here : (Supabase authentication | WeWeb documentation)

Then : On my signup portal, I created another signup form for admins where I add in the user metadata a field with ‘role : admin’
=> in my handle_new_user() function, i added that if the field “role” is found and equals to admin, insert a row in the userRoles table with the userId and the Admin’s role ID (if not found, the User role Id)

In a nutshell, I manage user roles in supabase and need the changes to be effective in Weweb

Result : it works and adds the row… BUT I have to disable RLS to have a propper sync with weweb.

Should I enable RLS in read (select) for everyone ? What about safety ? or only for the auhenticated user based on His ID ? (maybe not optimal on published version)
What do you think about my process ? Anything else in mind ?

Thanks you ! have a great day. I will dig into user groups and access to pages soon :wink:

Any clues for a smarter integration ? or a solution without the roles ?