romu
February 6, 2025, 4:26pm
1
Hi WW lovers.
My setup is WeWeb+Supabase(+auth).
In WeWeb → Auth, I see my users and their roles. But I can’t figure out how I can get this role data in a formula to show it on my screen.
Simple said: I want to show on my interface what role has the currently logged in user.
Any idea? Thanks.
julian
February 6, 2025, 5:03pm
2
Hey romu,
How about binding the name attribute in the roles object to a text?
romu
February 6, 2025, 5:17pm
3
Thanks Julian.
That’s exactly what I’m trying to achieve. I’ll come back soon with more information.
romu
February 7, 2025, 8:41am
4
Hi.
I finally figured out how to make it, just wonder if there is more efficient than having to write this:
Any advice?
julian
February 7, 2025, 8:46am
5
Don’t you have the role name in the user object that is returned by Supabase? You could simply get the value from the auth tab
romu
February 7, 2025, 9:01am
6
Indeed I managed to make it more simple this way:
I re-configured the userRoles collection to directly fetch the name of the roles, instead of the ID
This way, my formula gets more more simple:
julian
February 7, 2025, 9:20am
7
Okay, I don’t understand why you not simply select the name property in the user session object (see my screenshot), but at least you got a working solution!
romu
February 7, 2025, 9:39am
8
Because I’m stupid enough to not read everything, especially when it’s great added value .
So thank you very much, I’ve corrected to adopt your way of doing, that’s definitely better.