Code

Updated migration of userRDN
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 May 2010 13:26:29 +0000 (13:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 May 2010 13:26:29 +0000 (13:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18384 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_migrate_userRDN.inc

index 169039784fe5961e791ea496f6c2d42744220891..51e9694d598d03bd7a7b11caa23de6342f2a88f3 100644 (file)
@@ -72,10 +72,16 @@ class migrate_userRDN implements propertyMigration
 
                 list($name, $container) = preg_split("/,/",$dn,2);
                 if(preg_match("/^".preg_quote($initialValue,'/i')."/", $container)){
-                    $containerDN = preg_replace("/^".preg_quote($initialValue,'/')."/",$targetValue,$container);
-                    $dnTo = $name.",".$containerDN;
+                    $container = preg_replace("/^".preg_quote($initialValue,'/')."/",$targetValue,$container);
+
+                    // Ensure that we handle a valid gosaDepartment container.
+                    while(!isset($this->config->idepartments[$container])){
+                        $container = preg_replace("/^[^,]*+,/","",$container);
+                    }
+
+                    $dnTo = $name.",".$targetValue.$container;
                     if(!empty($targetValue) && !$ldap->dn_exists($targetValue.$container)){
-                        $this->found['add'][$containerDN] = array(); 
+                        $this->found['add'][$targetValue.$container] = array(); 
                     }
                     if($dn != $dnTo){
                         $this->found['move'][$dn] = $dnTo;