Hi Harris,

can you tell a bit about your directory structure? Do you have a flat
directory i.e. all Persons you are query for are below one OU, our do
you have a nested hierarchical directory structure?

Looking at the code I guess the latter is the case, and then it is clear
that onelevel search isn't working.

* You get the entry of the CEO.
* You get the "directreports" attribute which seems to contain DNs
* For each of those DNs you construct a new search, with the same search
base, the search filter includes the one DN.

==> In that case I think you can use the DN directly as search base and
search scope "object", because you already know the DN. The LDAP API
also contains a "lookup" method that you can use.

Kind Regards,
Stefan


> ... 
>                               SearchRequest sr = new SearchRequestImpl();
>                               sr.setBase(new Dn(searchBase));
> ...
>               sb.append("(&(objectClass=person)(distinguishedName=")
>                 
> .append(replaceFilterSpecialCharactersWithHexRepresentation(distinguishedName))
>                 .append("))");
> ...   
>                                       .setDirectReports(entry.get( 
> "directreports" ))


Reply via email to