I need a LDAP query for windows server 2012 AD starting from the username of a user and getting all his collegues. In my AD collegues ad identified with the same PRIMARY group. Is it possibile or should I need a two step query?
Thank you.
I need a LDAP query for windows server 2012 AD starting from the username of a user and getting all his collegues. In my AD collegues ad identified with the same PRIMARY group. Is it possibile or should I need a two step query?
Thank you.
不幸的是,LDAP 过滤语法不允许表达式中的子查询。
您必须将其分为两部分 - 首先获取用户的DirectoryEntry
记录,然后在单独的过滤器中使用他的 PrimaryGroupID,例如:
(&(objectClass=user)(sAMAccountName=JSmith)
现在假设JSmith
是默认“域用户”组 (513) 的一部分:
(&(objectCategory=person)(objectClass=user)(primaryGroupID=513))
这将返回共享相同 PrimaryGroupID 的所有用户。