Base solution for your next web application
Open Closed

Are the Permissions Cached? #1431


User avatar
0
tjackadams created

Hello,

i am currently just building a page to manage permissions.

I am using jstree to populate the tree and then submitting the selected (and half selected) checkboxes. The form is submitted to an app service method. The permissions are obtained via this method

var permissions = _permissionManager.GetAllPermissions().Where(p => updateUser.GrantedPermissions.Contains(p.Name));

where "updateUser.GrantedPermissions" is a list of string of the checkboxes.

i then call this method

await _userManager.SetGrantedPermissionsAsync(user, permissions);

Which all seems to work fine, i can see a new entry in the database which sets the IsGranted column for that particular permission/user to the correct value. The issue is when i come to load the permissions back up. When i make the call to pull the Permissions out of the database using this method

var grantedPermissions = await _userManager.GetGrantedPermissionsAsync(user);

the newly applied permission does not show. The newly applied permission only shows when i restart the application (in visual studio debug).

So it looks like it is caching the permissions maybe? My question is, is there any caching on permissions? if so, is there anyway i can disable it so it always queries for the latest permissions?

Many Thanks Thomas


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Yes, there is a caching. But it automatically detects when permissions are changed and refreshes the cache. If your problem is not solved, please created an issue: <a class="postlink" href="https://github.com/aspnetboilerplate/module-zero/issues/new">https://github.com/aspnetboilerplate/mo ... issues/new</a>