Hi,
I’ve built a website running MODx Revo 2.0.7 which has a number of users divided across 5 user groups. For simplicity let’s say they’re called "UG1"-"UG5". Users can be a member of any combination of groups, e.g. UG1 and UG3, or UG1 UG2 and UG4, etc...
This is all working fine and I am able to limit what these users see when logged in based on their access.
I’m in the process of building a Custom Manager Page which will list all of these users in a table in the Manager. This CMP takes into account the user groups I’ve created and various extended fields that these users have been given.
The problem I’m having is when I update the user groups of a user. Both the CMP and the front end do not update with the latest permissions unless I flush all sessions and log everybody out. Is there a modx function I can use to retrieve the uncached user groups for any particular user?
In fact, could I just turn off permissions caching entirely? or would this have a detrimental effect on performance?
At the moment I’m using $user->getUserGroups() whenever I need to check the user groups, where $user is a modUser object of course.
thanks in advance for any help.
Thanks for your input Jason, I figured disabling caching would be a bad idea.
I’ll submit a feature request for getUserGroups.
I think the only temporary workaround for this would be to manually query the database table `modx_member_groups` and pull out the raw data.
Update:
On further thought about this, the MODx manager must be able to get around this issue somehow. When a users access permissions are changed in Security -> Manager Users. The "Access Permissions" tab doesn’t appear to have a caching problem.