Menu based on roles

Hi,

I'm wanting to edit the visibility on a tree menu based on the roles of the signed in user. Right now I have a startup event on the tree menu but I cant seem to use system.security.getRoles() in the event so I'm not sure where to put the scripts. Where would be the ideal place to put setup altering the visibility of the menu items based on the user?

You don't need a script here, use an expression binding. In the menu tree, you have the visible and enabled properties for each item. Click on the little chain-link icon next to which ever you want to use and add an expression binding to determine whether the user can access it or not using isAuthorized.
isAuthorized - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)

1 Like

That's a really good idea, I might try to see if that can work, thank you!! the reason I was trying a script because I wanted it to apply to a subset of roles have a specific prefix and not to everyone, I would also need to it to work like 'user is part of group x so they can see only x' rather than 'user is group x so they can see x', so I just thought a script might be better - I'll see what I can do.

1 Like

I'd check out security levels and zones if you haven't already.
Security Levels Video at Inductive University

hi @pbg,

this can maybe help you.

Regards