ldap过滤器可搜索一个属性的多个值 [英] ldap filter to search for multiple values for an attribute
问题描述
在AD中,我具有多值属性"departmentNumber",该属性可以存储"dept1"和"dept2"之类的多个值.
In AD, I have multi valued attribute "departmentNumber" which may store multiple values like "dept1" and "dept2".
我正在寻找ldap过滤器,该过滤器应检索具有1个以上部门编号的用户.
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.
感谢您的帮助.
推荐答案
服务器将为与搜索参数匹配的每个条目返回一个多值属性的每个值(假设连接许可的授权状态).搜索响应将是与搜索参数匹配的对象的列表,每个对象都将是在搜索请求的请求属性参数中指定的属性(名称和值对)的列表.多值属性的所有值都将包含在搜索结果中.
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.
如果客户端需要dept1
和dept2
,则将它们作为断言包括在过滤器中,例如:
If the client desires dept1
and dept2
, then include those as assertions in the filter, for example:
(&(departmentNumber=dept1)(departmentNumber=dept2)(objectClass=whatever..))
示范
给出以下仅显示cn
和departmentNumber
的条目:
$ 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
请注意,搜索响应同时包含两个条目和两个值
departmentNumber
表示cn=user.1,ou=people,c=us
.
Note that the search response included both entries, and both values of
departmentNumber
for cn=user.1,ou=people,c=us
.
这篇关于ldap过滤器可搜索一个属性的多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!