netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.79k stars 2.54k forks source link

user permission take too long to reflect #6401

Closed kaalbhairava closed 3 years ago

kaalbhairava commented 3 years ago

NetBox version

v2.11.3

Python version

3.6

Steps to Reproduce

  1. go to admin page
  2. go to users
  3. select an existing user
  4. change the permission (custom read-write permission to custom read-only permission)
  5. save

Expected Behavior

user should be able to view only what is given in read-only permission

Observed Behavior

user still has the read-write permission and permission changes don't reflect immediately.

jeremystretch commented 3 years ago

User permissions take effect immediately. I'm not able to test your reported issue because the steps you've provided above are not sufficiently detailed. Please revise your post above to state exactly what you are doing at each step, starting with the initial user creation.

kaalbhairava commented 3 years ago

Apology for not providing the exact details. Following are the steps I performed from Netbox Administration Page:

  1. Created a user named TestUser1
  2. Created two permissions- ReadOnly - only view action is enabled for all objects ReadWrite - view, add, change, delete actions are enabled for all objects
  3. ReadWrite permission is given to TestUser1 after creation.
  4. After logging in as TestUser1 in Netbox , the given permission is getting reflected and I can perform view, add, change, delete actions
  5. Now, I went to Administration console and changed the permission of TestUser1 to ReadOnly
  6. Now, I again logged in as TestUser1, but I could still add IPAddresses and prefixes. After 20-30 mins the permission changes were reflected on the front end and now I could only view.
  7. After troubleshooting further, I found that the permission changes are getting reflected in database immediately (verified by querying the tables ), but not on the front end

** suspecting that somewhere something is getting cached because of which changes are not reflecting on front end immedately.

jeremystretch commented 3 years ago

Marking this as blocked by #6639 as it's believed to be a caching bug.

jeremystretch commented 3 years ago

This will be fixed in v3.0 with the removal of queryset caching. The workaround in the interim is to set CACHE_TIMEOUT = 0 in configuration.py.

fabricat commented 3 years ago

This should be already fixed v2.11.10, see #6781

jeremystretch commented 3 years ago

Note that #6781 just disables caching by default where CACHE_TIMEOUT is not set in configuration.py. If it's already been set on an existing installation, the change will have no effect: It still needs to be modified manually.