Code

Fixed Admin group and user creation, in case of empty group and or user ou
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 May 2007 13:09:05 +0000 (13:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 May 2007 13:09:05 +0000 (13:09 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6469 594d385d-05f5-0310-b6e9-bd551577e9d8

setup/class_setupStep_Migrate.inc

index cf487a90b68a27b72deb35156048fa9665065258..3daa0e3c6a277384d29b75ce872094b88ab826b2 100644 (file)
@@ -882,7 +882,13 @@ class Step_Migrate extends setup_step
         }
         
       }else{
-        $new_group_dn = "cn=GOsa Administrators,".$cv['groupou'].",".$cv['base'];
+
+        $group_ou = trim($cv['groupou']);
+        if(!empty($group_ou)){
+          $group_ou = trim($group_ou).",";
+        }
+
+        $new_group_dn = "cn=GOsa Administrators,".$group_ou.$cv['base'];
         $new_group_attrs['objectClass'] = array("gosaObject","posixGroup");
         $new_group_attrs['cn'] = "GOsa Administrators";
         $new_group_attrs['gosaSubtreeACL'] = ":all";
@@ -945,11 +951,16 @@ class Step_Migrate extends setup_step
 
     /* Get current base attributes */
     $ldap->cd($cv['base']);
-  
+
+    $people_ou = trim($cv['peopleou']);
+    if(!empty($people_ou)){
+      $people_ou = trim($people_ou).",";
+    }
+
     if($cv['peopledn'] == "cn"){
-      $dn = "cn=System Administrator,".$cv['peopleou'].",".$cv['base'];
+      $dn = "cn=System Administrator,".$people_ou.$cv['base'];
     }else{
-      $dn = "uid=".$uid.",".$cv['peopleou'].",".$cv['base'];
+      $dn = "uid=".$uid.",".$people_ou.$cv['base'];
     }
 
     $methods = @passwordMethod::get_available_methods_if_not_loaded();
@@ -966,7 +977,6 @@ class Step_Migrate extends setup_step
     $new_user['userPassword'] = $hash;
     
     $ldap->cd($cv['base']);
-  
     $ldap->cat($dn,array("dn"));
     if($ldap->count()){
       print_red(sprintf(_("Could not add administrative user, there is already an object with the same dn '%s' in your ldap database."),