0
votes

I need to list all members of all groups, where a given user (or a small group of users) are members.

The straightforward way to do it is to get the list of groups from the memberOf-attribute of the seed-user(s) and loop through them collecting their other members.

But, perhaps, there is some better way -- with advanced LDAP -- to do it in fewer (or even just one) query?

If it matters, I'm talking to Active Directory from a PHP-script using the ldap-extension. Thanks!

1

1 Answers

0
votes

For a given user, you can obtain all groups where the user is a member, including nested groups using the filter:

(member:1.2.840.113556.1.4.1941:=(CN=UserName,CN=Users,DC=YOURDOMAIN,DC=NET))

-jim