public void deleteUser(User user) {
        JID userJID = XMPPServer.getInstance().createJID(user.getUsername(), null);
        for (Group group : getGroups(userJID)) {
            if (group.getAdmins().contains(userJID)) {
                if (group.getAdmins().remove(userJID)) {
                    // Remove the group from cache.
                    groupCache.remove(group.getName());
                }
            }
            else {
                if (group.getMembers().remove(userJID)) {
                    // Remove the group from cache.
                    groupCache.remove(group.getName());
                }
            }
        }
        evictCachedUserForGroup(userJID.asBareJID());
    }
Deletes a user from all the groups where he/she belongs. The most probable cause
for this request is that the user has been deleted from the system.

@param user the deleted user from the system.
xmppserver/src/main/java/org/jivesoftware/openfire/group/GroupManager.java