[PR #15784] [MERGED] Closes #15754: Remove staff_only=True from admin menu items #14680

Closed
opened 2025-12-29 23:25:55 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/15784
Author: @jeremystretch
Created: 4/19/2024
Status: Merged
Merged: 4/19/2024
Merged by: @jeremystretch

Base: featureHead: 15754-admin-menu-remove-staff_only


📝 Commits (2)

  • a3b62f4 Remove the is_staff restriction for admin menu items
  • 68a7ccc Dissuade non-superusers from creating API tokens via the admin view

📊 Changes

3 files changed (+14 additions, -14 deletions)

View changed files

📝 netbox/netbox/navigation/menu.py (+4 -14)
netbox/templates/users/token_edit.html (+9 -0)
📝 netbox/users/views.py (+1 -0)

📄 Description

Fixes: #15754

  • Remove staff_only=True from all menu items
  • Add a warning to the API token edit view for non-superusers

There's an odd issue here where regular users will see the API token items under the admin menu, because by default all users have permission to create their own tokens. We also can't hide the menu item from non-superusers entirely, because it's valid to assign a non-superuser permissions to create tokens for specific other accounts (e.g. service accounts), which can only be done via the admin views. So, I've settled on displaying a warning for non-superusers directing them to create tokens using the relevant account views.

(Note that there's no security issue here: Attempting to create/modify a token for another user will fail just as it will in the current release. I just want to mitigate the inevitable confusion of having two paths to create a token.)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/15784 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 4/19/2024 **Status:** ✅ Merged **Merged:** 4/19/2024 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `15754-admin-menu-remove-staff_only` --- ### 📝 Commits (2) - [`a3b62f4`](https://github.com/netbox-community/netbox/commit/a3b62f41c088c69cd443040ba3e995c36f73a7c5) Remove the is_staff restriction for admin menu items - [`68a7ccc`](https://github.com/netbox-community/netbox/commit/68a7ccc930ee39161f17d2821cbd47ace8802b86) Dissuade non-superusers from creating API tokens via the admin view ### 📊 Changes **3 files changed** (+14 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `netbox/netbox/navigation/menu.py` (+4 -14) ➕ `netbox/templates/users/token_edit.html` (+9 -0) 📝 `netbox/users/views.py` (+1 -0) </details> ### 📄 Description ### Fixes: #15754 - Remove `staff_only=True` from all menu items - Add a warning to the API token edit view for non-superusers There's an odd issue here where regular users will see the API token items under the admin menu, because by default all users have permission to create their own tokens. We also can't hide the menu item from non-superusers entirely, because it's valid to assign a non-superuser permissions to create tokens for specific other accounts (e.g. service accounts), which can only be done via the admin views. So, I've settled on displaying a warning for non-superusers directing them to create tokens using the relevant account views. (Note that there's no security issue here: Attempting to create/modify a token for another user will fail just as it will in the current release. I just want to mitigate the inevitable confusion of having two paths to create a token.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:25:55 +01:00
adam closed this issue 2025-12-29 23:25:55 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14680