LDAP 过滤器中有多个否定运算符

LDAP More than one negation operators in filter

我尝试编写一个带有两个否定的 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))))

没有任何效果。 我已经 read 只有一个过滤器受 not 运算符的影响,但必须有一种方法可以表达类似 'not this AND not that' 的内容。 也许有人可以帮助我?

在 LDAP 的过滤器前缀表示法中 'not this and not that' 的基本形式是:

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

然而,根据德摩根定律,这相当于 'not (this or that)',或者:

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

你可能会觉得更清楚。