Page 1 of 1

LDAP search help needed

Posted: Mon Jun 24, 2002 4:34 am
by 9902468
I know username (cn=somename) and that o=my_o. How can I get to know in what usergroups the user is in? (ou)

I've tried it like this:

Code: Select all

$ou_rak=ldap_search($ldapConnection,"cn=".$users_username.",o=rollo", "ou=*");
This returns errormsg: Unable to perform search: no such object in...

I'm totally new to LDAP and its consepts. (And context ;), so any help is welcome.)

thanks

Posted: Thu Jun 27, 2002 9:01 pm
by volka
from ldap_list manual
Example 1. Produce a list of all organizational units of an organization
// $ds is a valid link identifier for a directory server
$basedn = "o=My Company, c=US";
$justthese = array("ou");
$sr=ldap_list($ds, $basedn, "ou=*", $justthese);
$info = ldap_get_entries($ds, $sr);
for ($i=0; $i<$info["count"]; $i++)
echo $info[$i]["ou"][0] ;
but I'm (still) unfamiliar with LDAP, so no further (context) advices from me ;)