retrieve all the groups a user is memberOf from active directory?
| From: | Bing Du | Date: | Thu, 25 Jan 2007 21:07:19 +0000 |
| Subject: | retrieve all the groups a user is memberOf from active directory? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-247793@lists.php.net to get a copy of this message | ||
Hi,
Sorry if the top is not closely PHP related. But I need to accomplish it
using PHP.
I can query the attribute 'memberOf' of a user from the active directory
server with no problem. The challenge I'm facing now is how to obtain all
the groups a user is member of. In many cases, a user can be in many
groups which could be nested. Say, user is a member of group B which is a
member of group A. So user should be member of group A implicitly. But
in active directory, user's account only has
memberOf: CN=Group_B,OU=security groups,OU=Users,OU=Coll,DC=some,DC=edu
I can then check if Group_B's LDAP entry has any 'memberOf' attribute, so
on and so on. If user's LDAP entry has multiple 'memberOf' attributes, I
have to check each one to see if each group has any parent groups.
Anybody ever had to deal with such a kind of issue and would like to shed
some light (better with some code samples) how it should be done
effectively? Any ideas would be greatly appreciated.
Thanks,
Bing