Hello,
i noticed that LDAP Directory doesn't support configuring multiple base DN's aswell as DN's for OU search.

is there already any fix or patch around?

thanks in advance
dominic

Comments

Anonymous’s picture

Title: LDAP Directory doesn't support multiple base DN's and ou search DN's » Multiple base DN's and ou search DN's are not supported
Anonymous’s picture

Assigned: » Unassigned
Category: support » bug
Priority: Normal » Major
Anonymous’s picture

I need help plz in implementing multiple DN's for OU search,
my code so far:

    // Check to see if we're supposed to be displaying OrganizationalUnits
  if ($edit2['ou_on'] != 0) {

    // Multiple OU DN foreach() loop
  foreach (explode("\r\n", $edit2['ou_dn']) as $oudn) {
	
    // Prepare LDAP Connetion
    $ldap_directory->setOption('server', $edit['server']);
    $ldap_directory->setOption('port', $edit['port']);
    $ldap_directory->setOption('attr_filter', $edit2['ou_filter']);
	
	
    // If there is no BINDDN and BINDPW -- the connect will be an anonymous connect
    $ldap_directoryconnect = $ldap_directory->connect($edit['binddn'], $edit['bindpw']);
	$entries = $ldap_directory->search($oudn, $edit2['ou_filter'], array($edit2['ou_attribute']));
    //$entries = $ldap_directory->search($edit2['ou_dn'], $edit2['ou_filter'], array($edit2['ou_attribute']));
	
    $options=array('');
    $eoptions=array('');
    $count = 0;
    while ($count < $entries['count']) {
      $eoptions[$count] = $entries[$count][$edit2['ou_attribute']][0];
      $count++;
    }
    $options = array_unique($eoptions);
    natcasesort($options);
    $options = array_reverse($options);
    $options[$count] = "Alle Abteilungen";
    $options = array_reverse($options);
    if ($edit2['ou_label'] != '') {
      $ou_label = $edit2['ou_label'];
    }
    else {
      $ou_label = t('Organizational Unit');
    }
} //foreach

    $form[$edit2['did']]['organizationalUnits'] = array(
      '#type' => 'select',
      '#title' => $ou_label,
      '#attributes' => array('style' => 'width: 160px;'),
      '#options' => $options,
      '#description' => t('Select an office.'),
    );
} 

I have defined the following OU search DN's:

ou=User,ou=test1,dc=mydomain,dc=local
ou=User,ou=test2,dc=mydomain,dc=local
ou=User,ou=test3,dc=mydomain,dc=local

At the moment it processes all of each OU DNs in the LDAP query,
but only displays the last one (test3) in the DropDown menu..

thanks