如何过滤包含特定用户的组的 LDAP 查询? [英] How do I filter an LDAP query for groups containing a specific user?

查看:37
本文介绍了如何过滤包含特定用户的组的 LDAP 查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 Active Directory LDAP 查询过滤到包含经过身份验证/绑定的用户(或任何用户)的组?这工作正常:

How do I filter an Active Directory LDAP query to groups containing the authenticated/bound user (or any user at all)? This works fine:

(&(objectClass=group)(member=*))
>>> lots of results

但我不能更详细:

(&(objectClass=group)(member=*S*))
>>> nothing

MSDN 提到使用这样的过滤器:

The MSDN mentions using a filter like this:

(member:1.2.840.113556.1.4.1941:=(cn=user1,cn=users,DC=x))

但即使忽略其中涉及的疯狂的超幻数,当我尝试使用它进行过滤时,我总是得到 0 个结果(甚至替换 cn=user1,cn=users,DC=x 用我自己的专有名称,甚至用 *) 替换它.

But even ignoring the crazy hyper magic number involved in that, I always get 0 results when I try to filter with that (even replacing cn=user1,cn=users,DC=x with my own distinguishedName, even replacing it with *).

推荐答案

您需要用户的完整 DN,即

You need the full DN of the user i.e

(&(member=CN=Your Name,OU=Your OU,DC=company,DC=com)(objectClass=group))

请注意,您不能在此使用 *

take note you cannot use * in this one

这篇关于如何过滤包含特定用户的组的 LDAP 查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆