Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

list groups from user with ldap

Tags:

php

ldap

I'm really new to LDAP and just got a connection between my php server and my ad server. I've succefully been able to authenticate users. Now I want to list all groups the users are in to see if he's an admin or not (or there might be another way?).

I have this so far:

    $ldap = ldap_connect("192.168.1.108");
    if ($ldap && $bind = @ldap_bind($ldap, $name."@foobar.com", $pw)) {
        // ldap_search and ldap_get_entries here i guess, but how?
    }

I've tried with ldap_search by reading the manual at php.net but I couldn't get it to work at all. Can somebody show me how to get it to work?

like image 441
Marwelln Avatar asked Jan 21 '23 09:01

Marwelln


1 Answers

I got it working with this post: http://www.php.net/manual/en/ref.ldap.php#99347 Thanks anyway Aaron.

like image 116
Marwelln Avatar answered Feb 03 '23 07:02

Marwelln