mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-17 22:49:59 +02:00
* Closes #20929: Require render_config permission for UI config rendering - Modified `ObjectRenderConfigView.has_permission()` to require both view and render_config permissions - Added `remove_permissions()` test helper to remove permissions from existing ObjectPermission objects - Added regression tests for Device and VirtualMachine render-config permission enforcement The `render_config` permission action was introduced in #16681 for API endpoints. This extends PR_7604_description to the UI render-config tabs, preventing users from viewing rendered configurations without explicit permission. * Address PR feedback * Address PR feedback
This commit is contained in:
@@ -67,6 +67,16 @@ class TestCase(_TestCase):
|
||||
obj_perm.users.add(self.user)
|
||||
obj_perm.object_types.add(object_type)
|
||||
|
||||
def remove_permissions(self, *names):
|
||||
"""
|
||||
Remove a set of permissions from the test user. Accepts permission names in the form <app>.<action>_<model>.
|
||||
"""
|
||||
for name in names:
|
||||
object_type, action = resolve_permission_type(name)
|
||||
ObjectPermission.objects.filter(
|
||||
actions__contains=[action], object_types=object_type, users=self.user
|
||||
).delete()
|
||||
|
||||
#
|
||||
# Custom assertions
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user