Jbisgood9999999
Jbisgood9999999

Reputation: 253

LDAP Searching two groups

i am trying a ldap search by java. I am using ldap ctx.

I found that there are two small trees i need to search from. For example:

resultsTest = lctx.search("OU=Company Beta,DC=example,DC=com", "something", SUBTREE_SCOPE);

(I am sure that "something" is correct because i tested a lot for the result)

There are team A, team B, team C, and team D inside Company Beta.

I found that if i add any one of them to the beginning of the search,

OU=team A

or

OU=team B

I can search the member in team A or team B. But i want to result search from team A and team B instead of search either one of them.

Can any one provide a helping hand? I had search from a lot of website but cannot found the solution.

Upvotes: 2

Views: 1906

Answers (1)

jwilleke
jwilleke

Reputation: 11056

many LDAP Server implementations will allow an extensible match search filter as defined in RFC 2254 that may allow you to perform just that.

Define your base above the OUs you wish to include within the search and then use a filter something like:

(&(|(ou:dn:=TeamA)(ou:dn:=TeamB))(objectclass=inetorgperson)(sn=willeke))

Let us know hot it goes.

Upvotes: 1

Related Questions