Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide Admin menu section for non-admins #17010

Open
alehaa opened this issue Jul 29, 2024 · 6 comments
Open

Hide Admin menu section for non-admins #17010

alehaa opened this issue Jul 29, 2024 · 6 comments
Labels
complexity: low Requires minimal effort to implement netbox status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation type: feature Introduction of new functionality to the application

Comments

@alehaa
Copy link
Contributor

alehaa commented Jul 29, 2024

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

@alehaa alehaa added status: needs triage This issue is awaiting triage by a maintainer type: feature Introduction of new functionality to the application labels Jul 29, 2024
@arthanson arthanson added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Jul 30, 2024
@arthanson arthanson removed their assignment Jul 30, 2024
@arthanson arthanson added complexity: low Requires minimal effort to implement and removed severity: low Does not significantly disrupt application functionality, or a workaround is available labels Jul 30, 2024
@alehaa
Copy link
Contributor Author

alehaa commented Sep 13, 2024

I volunteer to work on a PR for this feature.

@jhofmueller
Copy link

jhofmueller commented 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.

@jeremystretch jeremystretch added the netbox label Nov 1, 2024 — with Linear
@wz4
Copy link

wz4 commented Nov 8, 2024

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

ADMIN_MENU = Menu(
label=_('Admin'),
icon_class='mdi mdi-account-multiple',
groups=(
MenuGroup(
label=_('Authentication'),
items=(
MenuItem(
link='users:user_list',
link_text=_('Users'),
auth_required=True,
permissions=['users.view_user'],
buttons=(

@jhofmueller
Copy link

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 😎

@wz4
Copy link

wz4 commented Nov 13, 2024

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

@alehaa
Copy link
Contributor Author

alehaa commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: low Requires minimal effort to implement netbox status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

5 participants