How to get the user role in a formula?

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.

Hey romu,
How about binding the name attribute in the roles object to a text?

Thanks Julian.

That’s exactly what I’m trying to achieve. I’ll come back soon with more information.

Hi.
I finally figured out how to make it, just wonder if there is more efficient than having to write this:

Any advice?

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

Indeed I managed to make it more simple this way:

  1. I re-configured the userRoles collection to directly fetch the name of the roles, instead of the ID
  2. This way, my formula gets more more simple:

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! :slight_smile:

Because I’m stupid enough to not read everything, especially when it’s great added value :grimacing:.

So thank you very much, I’ve corrected to adopt your way of doing, that’s definitely better. :pray: