Code

Updated server->service->ldap
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Oct 2008 14:37:57 +0000 (14:37 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Oct 2008 14:37:57 +0000 (14:37 +0000)
-Update references

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12786 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc

index 4c1380fe70198e79afd65248c62f4d674d58ad96..3a86186ce3207ef32ded0cddfbb27b984bb7aae1 100644 (file)
@@ -19,6 +19,7 @@ class goLdapServer extends goService{
   var $cn                  = "";
   var $goLdapServerStatus  = "";
   var $goLdapBase          = ""; 
+  var $oldBase             = ""; 
   var $view_logged  =FALSE;
 
   var $krb_service_prefix = "ldap/";
@@ -37,6 +38,7 @@ class goLdapServer extends goService{
       }
       $this->goLdapBase= "ldap://$srv:389/".$config->current['BASE'];
     }
+    $this->oldBase = $this->goLdapBase;
   }
 
 
@@ -90,6 +92,34 @@ class goLdapServer extends goService{
     }
   } 
 
+  
+  function save()
+  {
+    goService::save();
+
+    /* Update object relation */
+    if(!empty($this->oldBase) && $this->oldBase != $this->goLdapBase){
+      $new = array();
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->search('(&(objectClass=GOhard)(gotoLdapServer=*'.$this->oldBase.'))',array("cn","gotoLdapServer"));
+      while($attrs = $ldap->fetch()){
+        $ldapServer = array();
+        for($i = 0 ; $i < $attrs['gotoLdapServer']['count'] ; $i ++ ){
+          $ldapServer[] = preg_replace("/".normalizePreg($this->oldBase)."/",$this->goLdapBase,$attrs['gotoLdapServer'][$i]);
+        }
+        $new[$attrs['dn']]['gotoLdapServer'] = $ldapServer;
+      }
+      foreach($new as $dn => $data){
+        $ldap->cd($dn);
+        $ldap->modify($data); 
+        if(!$ldap->success()){
+          msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
+        }
+      }
+    }
+  }
+
 
   /* Return plugin informations for acl handling */
   static function plInfo()