Hide unused navigation bar options by user permissions #8706
Replies: 3 comments 5 replies
-
I personally agree with you: I would prefer that any area that the user doesn't have access to should be hidden. Implementation-wise this would be trivial: instead of displaying a pane with a lock icon inside it, just don't display the pane - and hide the corresponding menu item. Jeremy said recently (#7800) that this would confuse users who can't see things that the documentation says should be present. But I note this already happens in some areas: for example you don't see a "Device Bays" tab on a device if it has no bays, you don't see the napalm tabs if the device Platform doesn't allow it, and you don't see the "Admin" menu item if you don't have the "is_staff" privilege. Furthermore, a local Netbox admin with "is_superuser" privilege will be able to see everything - and therefore can easily diagnose that if one of their local end-users can't see something, it's because their permissions don't allow it. There is an original issue at #426, which pre-dates the permissions capability in Netbox. |
Beta Was this translation helpful? Give feedback.
-
I've managed it with the help of Jason Yates from Netbox NetDev community. He edited the /opt/netbox/netbox/utilities/templates/navigation/menu.html code to this:
Now I see the options in the navigation menu depending of the menu items permission: Also I've made some other changes in /opt/netbox/netbox/netbox/navigation_menu.py to hide unused navigation submenu options, and in /opt/netbox/netbox/templates/home.html to empty the unused boxes at the main screen. Thanks for you response. |
Beta Was this translation helpful? Give feedback.
-
@VazquezFrancisco I can confirm it works? We would be interested with this a feature? Are you going to make a PR? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,


I need to hide the unused options in the left navigation bar.
I managed to hide them statically just commenting lines at the MENUS section starting from line 372 in the /opt/netbox/netbox/netbox/navigation_menu.py file.
The goal now is to hide the unused options depending by the users permissions. If an user doesn't have view permission to an specific option, then he shouldn't see it (now the user can see it with a lock icon). It can be done somehow?
Beta Was this translation helpful? Give feedback.
All reactions