# How to hide menu tree items based on roles

**URL:** <https://forum.inductiveautomation.com/t/how-to-hide-menu-tree-items-based-on-roles/92937>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [July 9, 2024, 3:57am UTC](https://forum.inductiveautomation.com/t/how-to-hide-menu-tree-items-based-on-roles/92937 "2024-07-09T03:57:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kavya\_shree](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kavya\_shree](https://forum.inductiveautomation.com/u/kavya_shree)\
**Post date:** [July 9, 2024, 3:57am UTC](https://forum.inductiveautomation.com/t/how-to-hide-menu-tree-items-based-on-roles/92937/1 "2024-07-09T03:57:53Z")

</div>

Hi Team,

I have created roles for Admin and operator.  
Here I am using Tree component for menu in perspective.  
I want to hide Dashboard if operator logs in as in below image..  
please guide.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/d/1d6328b2ed3d1400237a3a1eca961d4b3fa0a04d.png)

---

<div class="post-metadata">

**Author:** ![djs](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djs](https://forum.inductiveautomation.com/u/djs)\
**Post date:** [July 9, 2024, 1:11pm UTC](https://forum.inductiveautomation.com/t/how-to-hide-menu-tree-items-based-on-roles/92937/2 "2024-07-09T13:11:43Z")

</div>

You'll have to bind to the _items_ property or write to it in an _onStartup_ script. In the script, check if the current user has appropriate roles or security levels, and generate your tree structure appropriately.

If you right-click on your existing items and copy, you can then paste that into a script console to have a starting point to work from. (You'll have to capitalize boolean literals through...)

---

<div class="post-metadata">

**Author:** ![drojas](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drojas/32/3403_2.png) [@drojas](https://forum.inductiveautomation.com/u/drojas)\
**Post date:** [July 9, 2024, 2:22pm UTC](https://forum.inductiveautomation.com/t/how-to-hide-menu-tree-items-based-on-roles/92937/3 "2024-07-09T14:22:33Z")

</div>

Ignition hack: you could put

```python
true = True
false = False

```

as the top of your code so that you don't have to do all that boolean replacement.
