Commit 1223034e authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Quick and dirty fix to get correct list of groups for a user when using LDAP....

Quick and dirty fix to get correct list of groups for a user when using LDAP. Rollback this change when LDAP code is fixed.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5567 b35dd754-fafc-0310-a699-88a17e54d16e
parent 50fc71e1
......@@ -15,12 +15,16 @@ import org.jivesoftware.util.*;
import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.event.GroupEventDispatcher;
import org.jivesoftware.wildfire.event.GroupEventListener;
import org.jivesoftware.wildfire.ldap.LdapGroupProvider;
import org.jivesoftware.wildfire.user.User;
import org.jivesoftware.wildfire.user.UserManager;
import org.jivesoftware.wildfire.user.UserNotFoundException;
import org.xmpp.packet.JID;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
/**
* Manages groups.
......@@ -334,6 +338,16 @@ public class GroupManager {
* @return all groups that an entity belongs to.
*/
public Collection<Group> getGroups(JID user) {
// TODO Remove this temp fix for LDAP and fix LDAP to get correct list of groups of a user
if (provider.getClass() == LdapGroupProvider.class) {
Collection<Group> userGroups = new ArrayList<Group>();
for (Group group : getGroups()) {
if (group.isUser(user)) {
userGroups.add(group);
}
}
return userGroups;
}
String key = user.toBareJID();
Collection<String> groupNames = (Collection<String>)groupMetaCache.get(key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment