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

not able to delete legacy permissions #5113

Closed
marendres opened this issue Sep 9, 2020 · 8 comments
Closed

not able to delete legacy permissions #5113

marendres opened this issue Sep 9, 2020 · 8 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@marendres
Copy link

marendres commented Sep 9, 2020

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.

@jeremystretch
Copy link
Member

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 jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Sep 9, 2020
@marendres
Copy link
Author

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.

@thoms27
Copy link

thoms27 commented Sep 10, 2020

same issue

@ledgley
Copy link

ledgley commented 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

@jeremystretch
Copy link
Member

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.)

@ledgley
Copy link

ledgley commented Sep 21, 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

@jeremystretch
Copy link
Member

Looks like yet another caching bug.

@jeremystretch jeremystretch removed the status: revisions needed This issue requires additional information to be actionable label Sep 23, 2020
@lampwins
Copy link
Contributor

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: Suor/django-cacheops#287

@lampwins lampwins added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation labels Sep 26, 2020
@lampwins lampwins self-assigned this Sep 29, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

5 participants