Commit 9f33fb2765bf34e8a06be55a7141acfd04ef2c9d

Authored by michael
1 parent 01046efd

added line breaks and <pre> formatting


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2811 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 7 additions and 6 deletions
sync/migrateLDAP.php
... ... @@ -13,21 +13,22 @@ require_once(&quot;../config/dmsDefaults.php&quot;);
13 13 $aUsers = User::getList();
14 14  
15 15 // then initialise the LDAP authenticator with the new directory server address
16   -$sNewLdapServer = "smaurg.mrc.ac.za";
17   -$sNewLdapDn = "";
  16 +$sNewLdapServer = "jam001.jamwarehouse.com";
  17 +$sNewLdapDn = "CN=Users,DC=jamwarehouse,DC=com";
18 18 $oLdap = new LDAPAuthenticator($sNewLdapServer, $sNewLdapDn);;
19   -
  19 +echo "<pre>";
20 20 for ($i=0; $i<count($aUsers); $i++) {
21 21 // for each user, lookup the dn based on the username
22 22 $oUser = $aUsers[$i];
23 23 $aResults = $oLdap->searchUsers($oUser->getUserName(), array ("dn"));
24 24 if (count($aResults) > 1) {
25   - echo "retrieved " . count($aResults) . " matches for username=" + $oUser->getUserName();
26   - } else {
  25 + echo "retrieved " . count($aResults) . " matches for username=" . $oUser->getUserName() . ": " . arrayToString($aResults) . "<br>";
  26 + } else if (count($aResults) == 1) {
27 27 $sNewDN = $aResults[$oUser->getUserName()]["dn"];
28 28 // echo an update statement that sets the dn to the correct value
29   - echo "UPDATE users SET ldap_dn='" . $sNewDN . "' WHERE id=" . $oUser->getID();
  29 + echo "UPDATE users SET ldap_dn='" . $sNewDN . "' WHERE id=" . $oUser->getID() . "<br>";
30 30 }
31 31 }
32 32 echo "Change the configuration file to point to the new directory server-" . $sNewLdapServer;
  33 +echo "</pre>";
33 34 ?>
34 35 \ No newline at end of file
... ...