I have a script that I use to add and remove users from groups. At the start of the script, I call
ComponentAccessor.getGroupManager().getGroupNamesForUser(user)
to get the current list of groups for the user. After I have added and/or removed groups, I call it again. Instead of showing the new list of groups, I get the same list that I received from the first call.
It appears to me that this is either calling an index or a cache that is not being refreshed. However, when I look at the user in the User Management view, I can see that the correct actions have been taken.
Any suggestions on what call I should be making in conjunction or instead of this approach?