How to get all users in a specific "ou" using LDAP filters in PHP?

Viewed 31

In PHP's ldap_search is something like this:

$ldapserver = 'svr.domain.com';
$ldapuser   = 'administrator';
$ldappass   = 'PASSWORD_HERE';
$ldaptree   = "OU=SBSUsers,OU=Users,OU=MyBusiness,DC=myDomain,DC=local";
...
$result = ldap_search($ldapconn,$ldaptree, "(cn=*)") or die ("Error in search query: ".ldap_error($ldapconn));

we can select a specific subtree using $ldaptree. I'm using Laravel LdapRecord package and it only allows using filters during synchronization process.

Can you offer me a filter to select all users who have (OU=Users) in their dn?

0 Answers
Related