List of user groups with ldap

Asked

Viewed 1,357 times

0

I’m very young with LDAP and I made a connection between my php server and my ad server. Now I want to list all the groups, so that users see if he is an administrator or not (or there may be another way?).

I’ve got that 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 couldn’t make it work as a whole. Can anyone show me how to make it work?

1 answer

2

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

$res = ldap_search($ldap, 'dc=redward,dc,=org', '(objectClass=group)');
print_r(ldap_get_entries($link, $res));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.