[PR #20306] [MERGED] Closes #16137: Remove is_staff boolean from User model #15883

Closed
opened 2025-12-30 00:24:35 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20306
Author: @jeremystretch
Created: 9/9/2025
Status: Merged
Merged: 9/10/2025
Merged by: @jeremystretch

Base: featureHead: 16137-remove-user-is_staff


📝 Commits (6)

  • 7bc32db Closes #16137: Remove is_staff boolean from User model
  • e568cb0 Remove default is_staff value from UserManager.create_user()
  • cff1c84 Restore staff_only on MenuItem
  • 1695243 Introduce IsSuperuser API permission to replace IsAdminUser
  • a7cf237 Update and improve RQ task API view tests
  • 34b82be Remove is_staff attribute assignment from RemoteUserBackend

📊 Changes

30 files changed (+220 additions, -129 deletions)

View changed files

📝 docs/administration/authentication/overview.md (+1 -1)
📝 docs/configuration/remote-authentication.md (+0 -16)
📝 docs/installation/6-ldap.md (+0 -3)
📝 docs/plugins/development/navigation.md (+11 -8)
📝 netbox/core/api/views.py (+2 -2)
📝 netbox/core/tests/test_api.py (+86 -23)
📝 netbox/core/tests/test_views.py (+4 -4)
📝 netbox/core/views.py (+3 -3)
📝 netbox/netbox/authentication/__init__.py (+4 -16)
📝 netbox/netbox/plugins/views.py (+2 -2)
📝 netbox/netbox/settings.py (+0 -2)
📝 netbox/netbox/views/misc.py (+2 -2)
📝 netbox/templates/account/profile.html (+0 -4)
📝 netbox/templates/inc/user_menu.html (+0 -2)
📝 netbox/templates/media_failure.html (+1 -1)
📝 netbox/templates/users/user.html (+0 -4)
📝 netbox/users/api/serializers_/users.py (+1 -1)
📝 netbox/users/filtersets.py (+1 -1)
📝 netbox/users/forms/bulk_edit.py (+1 -6)
📝 netbox/users/forms/bulk_import.py (+1 -2)

...and 10 more files

📄 Description

Closes: #16137

  • Remove the is_staff boolean field from our custom User model
  • Remove the REMOTE_AUTH_STAFF_GROUPS and REMOTE_AUTH_STAFF_USERS configuration parameters
  • Introduced the IsSuperuser REST API permission to replace DRF's IsAdminUser (which evaluates is_staff)
  • Accessing UI & REST API views for RQ tasks now requires superuser permission
  • Accessing the installed plugins API view now requires superuser permission
  • Extend the RQ tasks view tests to check permissions enforcement consistently
  • RemoteUserBackend now infers is_staff from is_superuser
  • PluginMenuItem still supports the staff_only attribute, but it now maps to the is_superuser attribute on a user
  • Remove references to is_staff from the LDAP authentication docs

🔄 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/20306 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 9/9/2025 **Status:** ✅ Merged **Merged:** 9/10/2025 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `feature` ← **Head:** `16137-remove-user-is_staff` --- ### 📝 Commits (6) - [`7bc32db`](https://github.com/netbox-community/netbox/commit/7bc32db3a00d7e0509c342a41af0eeb641de2c84) Closes #16137: Remove is_staff boolean from User model - [`e568cb0`](https://github.com/netbox-community/netbox/commit/e568cb02dea3330783f5f898e78f231b1f453bf7) Remove default is_staff value from UserManager.create_user() - [`cff1c84`](https://github.com/netbox-community/netbox/commit/cff1c844cd4e90e26f0499916782894cf4241942) Restore staff_only on MenuItem - [`1695243`](https://github.com/netbox-community/netbox/commit/16952434b128a2ce0c5add9c1d183bc5781d04e0) Introduce IsSuperuser API permission to replace IsAdminUser - [`a7cf237`](https://github.com/netbox-community/netbox/commit/a7cf23777931e3119267973fc24c51642f2f434f) Update and improve RQ task API view tests - [`34b82be`](https://github.com/netbox-community/netbox/commit/34b82beee321c18db4c9d7d89b5004411be5c9d0) Remove is_staff attribute assignment from RemoteUserBackend ### 📊 Changes **30 files changed** (+220 additions, -129 deletions) <details> <summary>View changed files</summary> 📝 `docs/administration/authentication/overview.md` (+1 -1) 📝 `docs/configuration/remote-authentication.md` (+0 -16) 📝 `docs/installation/6-ldap.md` (+0 -3) 📝 `docs/plugins/development/navigation.md` (+11 -8) 📝 `netbox/core/api/views.py` (+2 -2) 📝 `netbox/core/tests/test_api.py` (+86 -23) 📝 `netbox/core/tests/test_views.py` (+4 -4) 📝 `netbox/core/views.py` (+3 -3) 📝 `netbox/netbox/authentication/__init__.py` (+4 -16) 📝 `netbox/netbox/plugins/views.py` (+2 -2) 📝 `netbox/netbox/settings.py` (+0 -2) 📝 `netbox/netbox/views/misc.py` (+2 -2) 📝 `netbox/templates/account/profile.html` (+0 -4) 📝 `netbox/templates/inc/user_menu.html` (+0 -2) 📝 `netbox/templates/media_failure.html` (+1 -1) 📝 `netbox/templates/users/user.html` (+0 -4) 📝 `netbox/users/api/serializers_/users.py` (+1 -1) 📝 `netbox/users/filtersets.py` (+1 -1) 📝 `netbox/users/forms/bulk_edit.py` (+1 -6) 📝 `netbox/users/forms/bulk_import.py` (+1 -2) _...and 10 more files_ </details> ### 📄 Description ### Closes: #16137 - Remove the `is_staff` boolean field from our custom User model - Remove the `REMOTE_AUTH_STAFF_GROUPS` and `REMOTE_AUTH_STAFF_USERS` configuration parameters - Introduced the `IsSuperuser` REST API permission to replace DRF's `IsAdminUser` (which evaluates `is_staff`) - Accessing UI & REST API views for RQ tasks now requires superuser permission - Accessing the installed plugins API view now requires superuser permission - Extend the RQ tasks view tests to check permissions enforcement consistently - `RemoteUserBackend` now infers `is_staff` from `is_superuser` - `PluginMenuItem` still supports the `staff_only` attribute, but it now maps to the `is_superuser` attribute on a user - Remove references to `is_staff` from the LDAP authentication docs --- <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-30 00:24:35 +01:00
adam closed this issue 2025-12-30 00:24:35 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15883