List of user groups with ldap

0

I am very new to LDAP and I made a connection between my php server and my ad server. Now I want to list all groups, so that users see if it is an admin or not (or can there be another path?).

I have this code so far:

$ldap = ldap_connect("192.168.1.108");
    if ($ldap && $bind = @ldap_bind($ldap, $name."@redward.org", $pw)) {
        // ldap_search e ldap_get_entries aqui eu acho, mas como?
    }

I tried with ldap_search reading the manual in php.net but I could not make it work as a whole. Can anyone show me how to make it work?

    
asked by anonymous 19.07.2014 / 04:12

1 answer

2

If you want to get all the groups available on the LDAP server you can use the "(objectClass = group)" filter, in this way it will filter all the records that have the objectClass of type "group".

$res = ldap_search($ldap, 'dc=redward,dc,=org', '(objectClass=group)');
print_r(ldap_get_entries($link, $res));
    
19.07.2014 / 22:42