1

我尝试编写一个带有两个否定的 LDAP 过滤器。我需要所有未被禁用且不属于 OU=Abt99 的用户。

这是我目前的过滤器:

(&(objectClass=user)(objectCategory=person)(samaccountname={USERNAME})(!(userAccountControl:1.2.840.113556.1.4.803:=2)))

我试过了

(&(objectClass=user)(objectCategory=person)(samaccountname={USERNAME})(!(userAccountControl:1.2.840.113556.1.4.803:=2)(OU=Abt99)))

(&(objectClass=user)(objectCategory=person)(samaccountname={USERNAME})(!(userAccountControl:1.2.840.113556.1.4.803:=2)!(OU=Abt99)))

并且

(&(objectClass=user)(objectCategory=person)(samaccountname={USERNAME})(&(!(userAccountControl:1.2.840.113556.1.4.803:=2)(OU=Abt99))))

没有任何效果。我读过只有一个过滤器受 not 运算符影响,但必须有一种方法可以说“不是这个而不是那个”。也许有人可以帮助我?

4

1 回答 1

2

LDAP 过滤器前缀表示法中“非此非彼”的基本形式是:

(&(!(this))(!(that)))

然而,根据德摩根定律,that 相当于“不是(这个或那个)”,或者:

(!(|(this)(that)))

您可能会发现更清楚。

于 2015-06-05T14:14:41.817 回答