Reputation: 797
I have this ldap scheme.
dc=company, dc=com
- ou=users
- uid=aaaa
- ou=car
- brand=audi
- brand=chevrolet
- uid=bbbb
- ou=car
- brand=ford
- brand=audi
- brand=chevrolet
- uid=cccc
- ou=car
- brand=ford
- brand=chevrolet
- uid=dddd
- ou=car
- brand=ford
- brand=audi
I need to get only users who don’t have ford car. It is possible to do it in one request ?
Thank you
Upvotes: 0
Views: 35
Reputation: 16572
It's kind of possible if you only need the DNs (and if your exclusion criteria also happens to be based on DNs), but not if you need non-DN attributes.
If all necessary data (both for the the child entry you want to exclude, and the user you want to find) is stored in DNs:
(&(objectClass=car)(brand=*))
(requesting no attributes).If child entries have to be matched by a non-DN attribute, then an additional search to find (brand=ford)
entries is needed (and then step 4 is "if childDN is in the badCars set, remove the respective userDN from the goodUsers set").
If you need to retrieve non-DN attributes, then at least one additional search to load users' attributes is needed. With Active Directory you can construct a filter like (|(distinguishedName=DN1)(distinguishedName=DN2)(...))
that lets you retrieve several users by their DN at once.
Upvotes: 1