Hello,
I'm doing some user & role handling using the database instead of DNN API. I assign roles to existing users invoking proper stored procedures and everything seems to be working fine except for a glitch I've found:
- When I assign a new role to an existing user that is currently logged in to the site (or was online recently) it seems the site doesn't acknowledge the role change for that user for some time (usually 10 or 15 minutes). Even when that user signs off and re-authenticate the new roles still don't seem to take effect until some time later.
- I'm able to see the roles assigned to the user (within DNN Admin pages) since the very beginning, the roles are being successfully assigned, the problem seems to be the site not knowing there was a change.
- If the user is new (I create a new user with roles assigned) when the user authenticates everything seems to work fine and all the roles are acknowledged.
- If the user is not new, but wasn't online for a while, new roles are recognized as soon he / she authenticates into the site.
- The problem gets automatically solved after some time or if the site or the general cache are reset.
- If I assign the same roles through DNN Admin section the site recognizes them right away, even when the target user is currently online and without the need to log off and re authenticate.
- I was able to verify the same problem in different DNN installations. All with version 7+
My guess is that there is some kind of "roles cache" going on in there that stores user information of online or recently online users and that is the cause of the problem. In addition, The fact that the roles change is working properly when done through DNN admin pages tells me that there must be an internal call to a "Reset Roles Cache" functionality or something similar. Does this make sense? I wasn't able to confirm any of this on my research.
My question is: Does the "Roles Cache" exists? If so, is there any way I can reset it full or for a particular user programmatically (without completely reset the whole site cache, of course)? Is there any configuration setting that controls this behavior? I've found that the "UpdateUser" stored procedure has a "RefreshRoles" parameter but passing "true" in there doesn't seem to change anything from me. Do you know what does that parameter means?
Please note that I'm sure switching to DNN API will very likely solve the problem but that is not an option right now for me. I would really appreciate if someone can put me in the right direction.
Thanks in advance.