private List < String > getGroups ( String dn ) throws WIMException { List < String > grpList = new ArrayList < String > ( ) ; String filter = iLdapConfigMgr . getGroupMemberFilter ( dn ) ; String [ ] searchBases = iLdapConfigMgr . getGroupSearchBases ( ) ; for ( int i = 0 ; i < searchBases . length ; i ++ ) { String searchBase = searchBases [ i ] ; NamingEnumeration < SearchResult > nenu = iLdapConn . search ( searchBase , filter , SearchControls . SUBTREE_SCOPE , LDAP_ATTR_OBJECTCLASS_ARRAY ) ; while ( nenu . hasMoreElements ( ) ) { SearchResult thisEntry = nenu . nextElement ( ) ; if ( thisEntry == null ) { continue ; } String entryName = thisEntry . getName ( ) ; if ( entryName == null || entryName . trim ( ) . length ( ) == 0 ) { continue ; } grpList . add ( LdapHelper . prepareDN ( entryName , searchBase ) ) ; } } return grpList ; }
Get the groups that contain the specified DN as its member .