In AD, I have multi valued attribute "departmentNumber" which may store multiple values like "dept1" and "dept2".
I am looking for ldap filter which should retrieve the users who has more than 1 departmentnumber.
I looked at other threads but that doesn't seems to work.
Any help is appreciated.
1. Search Filter is a basic LDAP Query for searching users based on mapping of username to a particular LDAP attribute. 2. The following are some commonly used Search Filters. You will need to use a search filter which uses the attributes specific to your LDAP environment.
LDAP filter used to search for groups according a search criteria. Searches for groups can be done using the user-search command or in the web administration console. $ SEARCH_STRING is the place holder for the search criteria. Group Member Attributes.
To create an LDAP queryBrowse the Directory manager tree and select an object in the LDAP directory. The query that you're creating will return results from this point in the tree down. Click the New LDAP query toolbar button. Type a descriptive name for the query.
The server will return each of the values of a multi-valued attribute for each entry which matches the search parameters (assuming the authorization state of the connection permits). The search response will be a list of objects which match the search parameters, and with each object all be a list of attributes (name and value pairs) which is specified in the requested attributes parameter of the search request. All values of a multi-valued attribute will be included in the search result.
If the client desires dept1
and dept2
, then include those as assertions in the filter, for example:
(&(departmentNumber=dept1)(departmentNumber=dept2)(objectClass=whatever..))
Given the follow entries from which only cn
and departmentNumber
are shown:
$ ldapsearch --baseDN 'ou=people,c=us' --searchScope one '(&)' cn departmentNumber
dn: cn=user.1,ou=People,C=us
cn: user.1
departmentNumber: dept1
departmentNumber: dept2
dn: cn=user.2,ou=People,C=us
cn: user.2
departmentNumber: dept2
Note that the search response included both entries, and both values of
departmentNumber
for cn=user.1,ou=people,c=us
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With