getName() == $sSourceName) { $oSource =& $oPotentialSource; } } if (empty($oSource)) { printf("No authentication source named %s found\n", $sSourceName); exit(1); } $oFieldset =& KTFieldset::getByNamespace($sFieldsetNamespace); if (PEAR::isError($oFieldset)) { printf("No fieldset named %s found\n", $sFieldsetNamespace); exit(1); } $oField = DocumentField::getByFieldsetAndName($oFieldset, $sFieldName); if (PEAR::isError($oField)) { printf("No field named %s found in fieldset %s\n", $sFieldName, $sFieldsetNamespace); exit(1); } $oAuthenticator =& KTAuthenticationUtil::getAuthenticatorForSource($oSource); $oLdap =& $oAuthenticator->oLdap; $aParams = array( 'scope' => 'sub', 'attributes' => array('cn'), ); $rootDn = $oKTConfig->get("ldap/ldapRootDn"); if (is_array($rootDn)) { $rootDn = join(",", $rootDn); } $aResults = $oLdap->search($rootDn, '(objectClass=organizationalPerson)', $aParams); $aValues = array(); foreach ($aResults->entries() as $oEntry) { // print $oEntry->dn() . "\n"; $sValue = $oEntry->get_value('cn', 'single'); // print $sValue . "\n"; $aValues[] = $sValue; } KTMetadataUtil::synchroniseMetadata($oField, $aValues);