Hide Admin menu section for non-admins #10023

Closed
opened 2025-12-29 21:25:51 +01:00 by adam · 13 comments
Owner

Originally created by @alehaa on GitHub (Jul 29, 2024).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v4.0.8

Feature type

Change to existing functionality

Proposed functionality

If a user is not an administrator, the Admin > System section of the menu should not be visible. If the user also lacks permissions for any menu item of Admin > Authentication, the Admin section should be hidden completely.

Use case

A user with no permissions can't see API Tokens, System and Background Tasks. However, these menu items are shown. Hiding them makes the UI a bit cleaner.

Database changes

None

External dependencies

None

Originally created by @alehaa on GitHub (Jul 29, 2024). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v4.0.8 ### Feature type Change to existing functionality ### Proposed functionality If a user is not an administrator, the `Admin > System` section of the menu should not be visible. If the user also lacks permissions for any menu item of `Admin > Authentication`, the `Admin` section should be hidden completely. ### Use case A user with no permissions can't see *API Tokens*, *System* and *Background Tasks*. However, these menu items are shown. Hiding them makes the UI a bit cleaner. ### Database changes None ### External dependencies None
adam added the status: acceptedtype: featurecomplexity: low labels 2025-12-29 21:25:51 +01:00
adam closed this issue 2025-12-29 21:25:51 +01:00
Author
Owner

@alehaa commented on GitHub (Sep 13, 2024):

I volunteer to work on a PR for this feature.

@alehaa commented on GitHub (Sep 13, 2024): I volunteer to work on a PR for this feature.
Author
Owner

@jhofmueller commented on GitHub (Oct 3, 2024):

Any news on this one? I hesitate to upgrade from 3.7.8 because I do not want to confuse our users. Stating that I have to add that this behavior was introduced in the 4.x branch.

@jhofmueller commented on GitHub (Oct 3, 2024): Any news on this one? I hesitate to upgrade from 3.7.8 because I do not want to confuse our users. Stating that I have to add that this behavior was introduced in the 4.x branch.
Author
Owner

@wz4 commented on GitHub (Nov 8, 2024):

This looks like it can be handled by assigning each MenuItem the attribute staff_only=True

fe0ae39903/netbox/netbox/navigation/menu.py (L381-L393)

@wz4 commented on GitHub (Nov 8, 2024): This looks like it can be handled by assigning each MenuItem the attribute staff_only=True https://github.com/netbox-community/netbox/blob/fe0ae39903f96e76f94d61ab7fb937980e861c4a/netbox/netbox/navigation/menu.py#L381-L393
Author
Owner

@jhofmueller commented on GitHub (Nov 11, 2024):

Thank you, but no. I don't want to mess with the code on our installation. I have avoided running NetBox from a dedicated code base (aka our own) so far and would like to stick to that. So I'm still hoping for the old behavior to be restored 😎

@jhofmueller commented on GitHub (Nov 11, 2024): Thank you, but no. I don't want to mess with the code on our installation. I have avoided running NetBox from a dedicated code base (aka our own) so far and would like to stick to that. So I'm still hoping for the old behavior to be restored :sunglasses:
Author
Owner

@wz4 commented on GitHub (Nov 13, 2024):

@arthanson I will volunterr unless @alehaa is still interested.

@wz4 commented on GitHub (Nov 13, 2024): @arthanson I will volunterr unless @alehaa is still interested.
Author
Owner

@alehaa commented on GitHub (Nov 13, 2024):

@wz4 you can take this one but I still volunteer as backup.

Please keep in mind there are plans to remove the staff field in #16137, checking the admin state would be preferable.

@alehaa commented on GitHub (Nov 13, 2024): @wz4 you can take this one but I still volunteer as backup. Please keep in mind there are plans to remove the staff field in #16137, checking the admin state would be preferable.
Author
Owner

@rmudingay commented on GitHub (Apr 10, 2025):

@wz4 or @alehaa, I’m also interested in this feature and wondered if there have been any updates regarding its implementation. Is it still planned for a future release, or has it already been included in a more recent update?
Thanks.

@rmudingay commented on GitHub (Apr 10, 2025): @wz4 or @alehaa, I’m also interested in this feature and wondered if there have been any updates regarding its implementation. Is it still planned for a future release, or has it already been included in a more recent update? Thanks. ⸻
Author
Owner

@arthanson commented on GitHub (Apr 24, 2025):

@wz4 are you still interested in doing this, I can assign to you

@arthanson commented on GitHub (Apr 24, 2025): @wz4 are you still interested in doing this, I can assign to you
Author
Owner

@abhi1693 commented on GitHub (May 3, 2025):

@jeremystretch I'd like to take this.

@abhi1693 commented on GitHub (May 3, 2025): @jeremystretch I'd like to take this.
Author
Owner

@jeremystretch commented on GitHub (May 5, 2025):

@abhi1693 first, please don't tag me when volunteering. Any maintainer can assign volunteers to an issue.

Second, please address the test failures in PR #19061 before taking on any additional work.

@jeremystretch commented on GitHub (May 5, 2025): @abhi1693 first, please don't tag me when volunteering. Any maintainer can assign volunteers to an issue. Second, please address the test failures in PR #19061 before taking on any additional work.
Author
Owner

@alehaa commented on GitHub (May 21, 2025):

I'd propose marking this as blocked by #19519. When an appropriate check is implemented for the admin views, this logic can be replicated to the menu.

@alehaa commented on GitHub (May 21, 2025): I'd propose marking this as blocked by #19519. When an appropriate check is implemented for the admin views, this logic can be replicated to the menu.
Author
Owner

@abhi1693 commented on GitHub (Sep 14, 2025):

I'm still available to volunteer for this issue

@abhi1693 commented on GitHub (Sep 14, 2025): I'm still available to volunteer for this issue
Author
Owner

@llamafilm commented on GitHub (Nov 18, 2025):

As a result of this change, combined with #20306, I think it will no longer be possible for regular users to view User and Group models. Is that intentional? I like to grant some users permission to view those models without editing them, which is possible today (in 4.4) by making them staff with the right permissions.

I haven't actually tested this the 4.5 feature branch yet because Github is partially broken today, I'm just looking at the code and it seems like this would happen.

Image
@llamafilm commented on GitHub (Nov 18, 2025): As a result of this change, combined with #20306, I think it will no longer be possible for regular users to view `User` and `Group` models. Is that intentional? I like to grant some users permission to _view_ those models without editing them, which is possible today (in 4.4) by making them staff with the right permissions. I haven't actually tested this the 4.5 feature branch yet because Github is partially broken today, I'm just looking at the code and it seems like this would happen. <img width="722" height="508" alt="Image" src="https://github.com/user-attachments/assets/2bc76884-b98d-4cb1-896e-ced001d4add9" />
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10023