Dynamic Menu Trees in Perspective

Is it possible to have a dynamic menu tree?

I can wall views away from users depending on the view permissions but can I hide menu items so that restricted users can’t navigate to those pages?

So I added a custom property to the menu called SecurityLevels and bound that to session.props.auth.securityLevels

Wrote a change script so that whenever the user changed (or their clearance) then the menu would get rebuilt - all good so far

Apart from…

I’m really struggling parsing the returned securityLevels. I initially put it in the too hard basket and just converted it to a string and did:

securityLevels = str(currentValue.value)

if "Line 1" in securityLevels:
	menu.append(menuLine1)
if "Line 4" in securityLevels:
	menu.append(menuLine4)

But this isn’t working too well for reasons that are beyond me at the moment

Edit: Ah! Added a script transform to my securityLevels custom property which transformed it to return str(value) and all is good in the hood

2 Likes