简体   繁体   English

LDAP 过滤器语法查询

[英]LDAP Filter Syntax Query

What would be the syntax for LDAP for the below scenario:对于以下场景,LDAP 的语法是什么:

Where sAMAccountName = GRA-* without $.其中 sAMAccountName = GRA-* 没有 $. I want the records which are highlighted in green.我想要以绿色突出显示的记录。

This is my current LADP Filter for your reference:这是我目前的 LADP 过滤器供您参考:

(&(objectClass=user)sAMAccountName=GRA-*))

Anyone, Please help with the correct syntax.任何人,请帮助正确的语法。

Your filter can work, but you're missing a ( in front of sAMAccountName :您的过滤器可以工作,但您缺少一个(sAMAccountName前面:

(&(objectClass=user)(sAMAccountName=GRA-*))

But you may be able to do better.但你也许可以做得更好。 If those ones that end in $ are computer objects (which always have sAMAccountName s that end in $ , but also have an objectClass of user ), then you can make sure you only get user objects by including (objectCategory=person) :如果那些以$结尾的是计算机对象(它们总是有以$结尾的sAMAccountName ,但也有一个objectClass of user ),那么你可以通过包含(objectCategory=person)来确保你只获得用户对象:

(&(objectClass=user)(objectCategory=person)(sAMAccountName=GRA-*))

If, for whatever reason, those $ objects are actually user accounts, then you can exclude them with (!sAMAccountName=*$) :如果出于某种原因,那些$对象实际上是用户帐户,那么您可以使用(!sAMAccountName=*$)排除它们:

(&(objectClass=user)(objectCategory=person)(sAMAccountName=GRA-*)(!sAMAccountName=*$))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM