not able to delete legacy permissions #4082

Closed
opened 2025-12-29 18:33:00 +01:00 by adam · 8 comments
Owner

Originally created by @marendres on GitHub (Sep 9, 2020).

Originally assigned to: @lampwins on GitHub.

Environment

  • Python version: 3.8.2
  • NetBox version: 2.9.3

Steps to Reproduce

  1. Select group with permissions from earlier netbox version
  2. select "delete?" for a object_permission
  3. click "save"

Expected Behavior

Saves the Group and removes the selected permission

Observed Behavior

As expected the group is closed and there is the banner: "The Group “myGroup" was changed successfully."
But the permission still shows up in the group overview, though in change permission menu of the same permission the group is not mentioned anymore.

Originally created by @marendres on GitHub (Sep 9, 2020). Originally assigned to: @lampwins on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.8.2 * NetBox version: 2.9.3 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. Select group with permissions from earlier netbox version 2. select "delete?" for a object_permission 3. click "save" <!-- What did you expect to happen? --> ### Expected Behavior Saves the Group and removes the selected permission <!-- What happened instead? --> ### Observed Behavior As expected the group is closed and there is the banner: "The Group “myGroup" was changed successfully." But the permission still shows up in the group overview, though in change permission menu of the same permission the group is not mentioned anymore.
adam added the type: bugstatus: accepted labels 2025-12-29 18:33:00 +01:00
adam closed this issue 2025-12-29 18:33:00 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 9, 2020):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v2.9.3. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.

@jeremystretch commented on GitHub (Sep 9, 2020): Thank you for opening a bug report. I was unable to reproduce the reported behavior on NetBox v2.9.3. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary. Remember to provide detailed steps that someone else can follow using a clean installation of NetBox to reproduce the issue. Remember to include the steps taken to create any initial objects or other data.
Author
Owner

@marendres commented on GitHub (Sep 9, 2020):

The initial objects and permissions have been created in early versions of netbox.
But the permissions are not showing up in the group overview anymore, there seemed to be some kind of delay.

I am able to reproduce this with adding permissions as well:

  1. create permission
  2. add permission to group
    => permission is not visible in the group configuration but the group is associated with the permission. After a few hours it appears.

As the permissions can be removed after all, the impact of this is not too big.

@marendres commented on GitHub (Sep 9, 2020): The initial objects and permissions have been created in early versions of netbox. But the permissions are not showing up in the group overview anymore, there seemed to be some kind of delay. I am able to reproduce this with adding permissions as well: 1. create permission 2. add permission to group => permission is not visible in the group configuration but the group is associated with the permission. After a few hours it appears. As the permissions can be removed after all, the impact of this is not too big.
Author
Owner

@thoms27 commented on GitHub (Sep 10, 2020):

same issue

@thoms27 commented on GitHub (Sep 10, 2020): same issue
Author
Owner

@ledgley commented on GitHub (Sep 17, 2020):

same issue

edit: changes are reflected via the API. For example if I delete a permission from the Admin interface it will still show in the list, but I can request that specific permission via the API and it is not present.

GET /api/users/permissions/?group=NetworkServicesNetBoxAll&name=extras.scripts-reports_modify

@ledgley commented on GitHub (Sep 17, 2020): same issue edit: changes are reflected via the API. For example if I delete a permission from the Admin interface it will still show in the list, but I can request that specific permission via the API and it is not present. GET /api/users/permissions/?group=NetworkServicesNetBoxAll&name=extras.scripts-reports_modify
Author
Owner

@jeremystretch commented on GitHub (Sep 21, 2020):

I'm not able to replicate anything resembling the reported behavior.

Does it still happen if you disable caching? (Set CACHE_TIMEOUT = 0 in configuration.py and restart NetBox to disable caching.)

@jeremystretch commented on GitHub (Sep 21, 2020): I'm not able to replicate anything resembling the reported behavior. Does it still happen if you disable caching? (Set `CACHE_TIMEOUT = 0` in `configuration.py` and restart NetBox to disable caching.)
Author
Owner

@ledgley commented on GitHub (Sep 22, 2020):

I tested the following:

Set CACHE_TIMEOUT = 120 & restart NetBox

  1. Grant User Permission
  • Present via Admin panel immediately
  • Present via API immediately

Wait 2 minutes

  1. Revoke User Permission
  • Permission still present in Admin Panel
  • Absent via API immediately
  • After two minutes permission is absent in Admin panel

Set CACHE_TIMEOUT = 0 & restart NetBox

  1. Grant User Permission
  • Present via Admin panel immediately
  • Present via API immediately
  1. Revoke User Permission
  • Absent via Admin panel immediately
  • Absent via API immediately
@ledgley commented on GitHub (Sep 22, 2020): I tested the following: Set `CACHE_TIMEOUT = 120` & restart NetBox 1. Grant User Permission * Present via Admin panel immediately * Present via API immediately Wait 2 minutes 1. Revoke User Permission * Permission still present in Admin Panel * Absent via API immediately * After two minutes permission is absent in Admin panel Set `CACHE_TIMEOUT = 0` & restart NetBox 1. Grant User Permission * Present via Admin panel immediately * Present via API immediately 1. Revoke User Permission * Absent via Admin panel immediately * Absent via API immediately
Author
Owner

@jeremystretch commented on GitHub (Sep 23, 2020):

Looks like yet another caching bug.

@jeremystretch commented on GitHub (Sep 23, 2020): Looks like yet another caching bug.
Author
Owner

@lampwins commented on GitHub (Sep 26, 2020):

First, I can confirm this bug with these steps:

  1. For simplicity, start with no groups or permissions, and ensure caching is enabled
  2. Navigate to Groups in the admin panel
  3. Add a new group and save
  4. Navigate to the new group in the admin panel
  5. Click the plus button to create a new object permission
  6. In the pop-up, create new object permission and save
  7. Click save on the group
  8. Navigate to back to the group and notice the new object permission is not listed, even though it is linked and can be confirmed by viewing the groups listed on the object permission's details.

I am able to resolve this by adding .nocache() to ObjectPermissionInline.get_queryset() but I am not entirely sure what the root cause is here yet. I think it has something to do with the explicit use of the through models in the inline forms for AdminUser and AdminGroup.

I know cacheops explicitly disables caching for ModelAdmin forms and I have asked for some clarification here: https://github.com/Suor/django-cacheops/issues/287

@lampwins commented on GitHub (Sep 26, 2020): First, I can confirm this bug with these steps: 0. For simplicity, start with no groups or permissions, and ensure caching is enabled 1. Navigate to Groups in the admin panel 2. Add a new group and save 3. Navigate to the new group in the admin panel 4. Click the plus button to create a new object permission 5. In the pop-up, create new object permission and save 6. Click save on the group 7. Navigate to back to the group and notice the new object permission is not listed, even though it is linked and can be confirmed by viewing the groups listed on the object permission's details. I am able to resolve this by adding `.nocache()` to `ObjectPermissionInline.get_queryset()` but I am not entirely sure what the root cause is here yet. I think it has something to do with the explicit use of the through models in the inline forms for `AdminUser` and `AdminGroup`. I know cacheops explicitly disables caching for `ModelAdmin` forms and I have asked for some clarification here: https://github.com/Suor/django-cacheops/issues/287
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4082