by georkame » 14.02.2011, 20:33
Thank you for this posting, works great,
we use Active Directory, so in that section I had to add the user OU in the base DN, otherwise it won't fetch.
$x = 'SelfBindActiveDirectory';
$ldap[$x]['Server'] = 'our server'; // Server accessed
$ldap[$x]['BindAsMe'] = false; // Bind as the attempting user (otherwise bind as User/Pass and search for this user)
$ldap[$x]['Search'] = true; // Search regardless of who binds (e.g. to bind to AD as the DOMAIN\USER form - but search for sAMAAccountName to get the DN)
$ldap[$x]['BaseDN'] = 'ou=where the users are to look for ,dc=our domain,dc=our domain'; // Base of LDAP tree
$ldap[$x]['uid'] = 'sAMAccountName'; // User ID field of users
$ldap[$x]['oclass'] = 'User'; // Objects to restrict user search to (if searching)
$ldap[$x]['BindDN'] = 'a user that can search AD-LDAP'; // If BindAsMe is false, bind as this ldap user - make both empty for anonymous bind
$ldap[$x]['BindPW'] = 'The password for the user above'; // If BindAsMe is false, bind with this password
$ldap[$x]['UserForm'] = 'domain\\$user'; // If not empty; replace USERNAME with $user; bind with this and $pass
$ldap[$x]['Email'] = 'mail'; // Email attribute in LDAP
$ldap[$x]['Company'] = 'physicalDeliveryOfficeName'; // Company attribute in LDAP
thank you.