使用通配符的ldap查询 [英] ldap query with wildcard
问题描述
我有一个类似下面的查询
I have a query like below
(|(distinguishedName=cn=Game_BI_CHARGE_BACK,ou=Groups,ou=FC,dc=na,dc=company,dc=com)(distinguishedName=cn=Game_BI_Compliance,ou=Groups,ou=FC,dc=na,dc=company,dc=com)(distinguishedName=cn=Game_BI_Finance,ou=Groups,ou=FC,dc=na,dc=company,dc=com)(distinguishedName=cn=Game_BI_GP,ou=Groups,ou=FC,dc=na,dc=company,dc=com)(distinguishedName=cn=Game_BI_MANAGED_CARE,ou=Groups,ou=FC,dc=na,dc=company,dc=com)(distinguishedName=cn=Game_BI_MEDICAID,ou=Groups,ou=FC,dc=na,dc=company,dc=com)(distinguishedName=cn=Game_BI_PowerUser,ou=Groups,ou=FC,dc=na,dc=company,dc=com)(distinguishedName=cn=Game_BI_TRADE,ou=Groups,ou=FC,dc=na,dc=company,dc=com)(distinguishedName=cn=Game_BI_TRICARE,ou=Groups,ou=FC,dc=na,dc=company,dc=com))
我想使用通配符来缩短它,所有组名都以Game_BI开头.上面的查询有效,我只想简短一点.
I want to shorten it using wildcard, All the group names start with Game_BI. The above query works, I just want to make it short.
谢谢 沙什
推荐答案
您不能使用通配符*
字符来过滤distinguishedName
属性-只有完全匹配才有效.您可以在LDAP条款部分下找到有关此内容的更多信息:
You cannot use the wildcard *
character to filter the distinguishedName
attribute - only exact matches will work. You can read more about that here, under the LDAP Clauses section :
但是,根据您当前的过滤条件,您可以按规范名称或cn
进行通配符搜索,并得到相同的结果:
However, according to your current filter, you could do a wildcard search by canonical name, or cn
, and get the same result :
(&(objectClass=group)(cn=Game_BI*))
也就是说,给我所有以"Game_BI"开头的规范名称的组.
That says, "Give me all the groups that have a canonical name that begins with "Game_BI".
这篇关于使用通配符的ldap查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!