Getting a list of current user's roles

I'm trying to enable/disable items in my views based on the user's roles but I can't seem to find a list of the session user's roles.

I was thinking I could add them to a label to reference while I'm working on the view. gives me the list of all roles and not the ones the user has.

edit: I wanted to add that the roles are obviously there in the designer because I can see them in the tag browser under [system]Client/User/RoleString but when I try to add them as an expression I get a Bad_NotFound error.

What platform are you on, Vision or Perspective?

In perspective, session.props.auth.user.roles should give the list of roles for the current logged in user.

in Vision, returns the roles of the currently logged in user. If you are seeing all the roles when calling this, check what roles are assigned to whatever user you are logging in as for testing. If you are testing in the designer, it will return all roles of the user you logged into the designer with.

There is also the 'RolesDataSet' tag that you could try. Note that the RolesString and RolesDataset are only available in vision, for perspective use the prop I mentioned above


Use an expression binding. There are two user functions, hasRole and isAuthorized.


Yes, I should have mentioned. I'm using perspective.

That was it! My issue was trying to use the tags. session.props.auth.user.roles did the trick, thank you!

Thank you @Transistor, helpful as always!