LDAP Group Membership - Primary Group not appearing
| From: | Craig Roberts | Date: | Sun, 09 Feb 2003 16:07:23 +0000 |
| Subject: | LDAP Group Membership - Primary Group not appearing | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-18413@lists.php.net to get a copy of this message | ||
Hey,
I'm trying to find out what groups a user is a member of. I have written
the following code, which returns the DN of some of the groups:
$ldap = ldap_connect("curric-srv");
ldap_bind($ldap, "willik@domain", "(password)");
$sr = ldap_search($ldap, "DC=domain", "cn=98ROBERC");
$data = ldap_get_entries($ldap, $sr); foreach($data[0]["memberof"] as
$group) {
echo("$group <br>");
}
This produces the following:
2
CN=Students,CN=Users,DC=domain
CN=98,CN=Users,DC=domain
This identifies two of the three groups this user belongs to. It's
missing the primary group, and I can't see any why to find out what that
group is. If I change the primary group using the AD Users and Computers
Applet, then the group that disapears changes to the group I set as
primary, and the group that was primary is then included in the array.
I know there is also returned from the search a value of
$data[0]["primarygroupid"][0], which contains a number. However when I
select data on the group I know to be the user's primary, there is no
mention of this number.
How will I find out the user's primary group - is it possible?
Set up: Apache 1.3.27, PHP 4.3.0, Windows 2000 Server
The script is connecting to the PDC, which is also running Windows 2000
server...
Thanks for your time,
Craig Roberts
MSN/E-mail: CraigRoberts@CJRobs.NeT
URL: http://cjrobs.net