UserService plugin not removing group memberships

Hi,

I am using userService plugin to managed shared group rosters. It seems to be working fine when new user is being added; the user gets added to the right groups. But when I update the user, any new group membership is being updated correctly. But removal of group memberships seems to be a bit unreliable.

Let me give an example:

  1. User1 already has membership in Group1 and Group2
  2. I now want to update User1 so that he is a member of Group1 and Group3; but not Group2.
  3. So I make a GET request to userService as follows: https://openfireserver:9091/plugins/userService/userService?type=update&user=Use r1&groups=Group1,Group3

In the above scenario, the user is correctly getting added to Group3; but the membership is not being removed from Group2. I tried clearing the cache; also had a look the code for userService and everything seems to be in-place for this behaviour. I just couldn’t figure why it behaves the way it does.

One important thing to note is that the user most probably will have an active XMPP session during the call the userService. Could that be causing any issues?

Thanks

Raghu

Following up on this issue as it is still happening for us. Anyone have any thoughts or experienced this as well?

We have an openfire integration where when a user is removed from a group in our database, we also call out and remove the user from the group in openfire using the UserService. However, this removal doesn’t seem to happen.

We were hoping that this was fixed in 3.9.1 release as we saw that there were some fixes to UserService such as http://issues.igniterealtime.org/browse/OF-719

Looking at the code for the updateUser method in the userService plugin, it all looks clean and correct, which makes me think that the problem is deeper in the openfire group.getMembers method.


public void updateUser(String username, String password, String name, String email, String groupNames)

{

if (groupNames != null) {

Collection newGroups = new ArrayList();

StringTokenizer tkn = new StringTokenizer(groupNames, “,”);

while (tkn.hasMoreTokens()) {

try {

newGroups.add(GroupManager.getInstance().getGroup(tkn.nextToken()));

} catch (GroupNotFoundException e) {

// Ignore this group
}

}

Collection existingGroups = GroupManager.getInstance().getGroups(user);

// Get the list of groups to add to the user
Collection groupsToAdd = new ArrayList(newGroups);

groupsToAdd.removeAll(existingGroups);

// Get the list of groups to remove from the user
Collection groupsToDelete = new ArrayList(existingGroups);

groupsToDelete.removeAll(newGroups);

// Add the user to the new groups
for (Group group : groupsToAdd) {

group.getMembers().add(server.createJID(username, null));

}

// Remove the user from the old groups
for (Group group : groupsToDelete) {

group.getMembers().remove(server.createJID(username, null));

}

}

}

Filed OF-748, I wonder if the group cache is not getting refreshed during this operation.

Is that still valid? I can not reproduce that.

Steps:

  1. http://localhost:9090/plugins/userService/userservice?type=update&secret=1234134 &username=admin111&groups=Group1,Group2

User is in Group 1 and 2

  1. http://localhost:9090/plugins/userService/userservice?type=update&secret=1234134 &username=admin111&groups=Group1,Group3

User is now in Group 1 and 3 and is removed from Group 2