Code

Added prefix for RDN migration
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 14 May 2010 08:29:00 +0000 (08:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 14 May 2010 08:29:00 +0000 (08:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18470 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/addons/configViewer/migration/class_migrateRDN.inc

index 50ace96793c497379edb8fbfc5ef3cfb95a3871e..046b3ef59d8745f0fb90083a023faad4d60d1932 100644 (file)
@@ -9,6 +9,14 @@ class migrateRDN implements propertyMigration
     protected $found = array();
     protected $filter ="";
 
+    // Additional suffixes or prefixes 
+    // e.g. for 'faiScriptRDN' (ou=scripts,) moving to new destination lets say 
+    //  to 'ou=FAIscripts,' would break stuff with having 'ou=fai,ou=systems,ou=config' 
+    // prepended.
+    // 
+    protected $suffix = ""; 
+    protected $prefix = ""; 
+
     function __construct($config,$property)
     {
         $this->property = &$property;
@@ -24,8 +32,9 @@ class migrateRDN implements propertyMigration
         $ldap2->cd($this->config->current['BASE']);
 
         // If the userRDN wasn't empty, then only search for users inside of the old userRDN.
-        $initialValue = $this->property->getValue();
-        $targetValue = $this->property->getValue(TRUE);
+        $initialValue = $this->prefix.$this->property->getValue().$this->suffix;
+        $targetValue = $this->prefix.$this->property->getValue(TRUE).$this->suffix;
+
         $dnMatch = "";
         if(!empty($initialValue)){
             foreach(preg_split("/,/", $initialValue) as $rdnPart){
@@ -80,6 +89,7 @@ class migrateRDN implements propertyMigration
                         $container = preg_replace("/^[^,]*+,/","",$container);
                     }
 
+
                     $dnTo = $name.",".$targetValue.$container;
                     if(!empty($targetValue) && !$ldap->dn_exists($targetValue.$container)){
                         $this->found['add'][$targetValue.$container] = array();