Code

There is a seperate button for each admin create method
[gosa.git] / setup / class_setupStep_Schema.inc
index d8e9e32c859d3505bfae937ce7b8485a5d97f5ff..8d22f6ed60e352384a9620edfc653969862a57f7 100644 (file)
@@ -37,9 +37,9 @@ class Step_Schema extends setup_step
   
   function update_strings()
   {
-    $this->s_title      = _("Ldap schema check");
-    $this->s_title_long = _("Ldap schema check");
-    $this->s_info       = _("This dialog checks your ldap schema setup");
+    $this->s_title      = _("LDAP schema check");
+    $this->s_title_long = _("LDAP schema check");
+    $this->s_info       = _("Perform test on your current LDAP schema");
   }
 
   
@@ -56,7 +56,7 @@ class Step_Schema extends setup_step
     if($failed_checks == 0){
       $this->is_completed = TRUE;
     }else{
-      $this->is_completed = FALSE;
+      $this->is_completed = TRUE;
     }
 
     $smarty = get_smarty();
@@ -69,10 +69,9 @@ class Step_Schema extends setup_step
     return($smarty -> fetch (get_template_path("../setup/setup_schema.tpl")));
   }
 
-  function check_schema_version($description, $version)
+  function check_schema_version($class, $version)
   {
-    $desc= preg_replace("/^.* DESC\s+\(*\s*'([^']+)'\s*\)*.*$/", '\\1', $description);
-    return preg_match("/\(v$version\)/", $desc);
+    return preg_match("/\(v$version\)/", $class['DESC']);
   }
 
 
@@ -99,7 +98,7 @@ class Step_Schema extends setup_step
     $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']);
     $objectclasses = $ldap->get_objectclasses();
     if(count($objectclasses) == 0){
-      return (array(array("msg" => _("Can't get schema information from server. No schema check possible!"), "status" => FALSE)));
+      print_red(_("Can't get schema information from server. No schema check possible!"));
     }
 
   
@@ -206,19 +205,37 @@ class Step_Schema extends setup_step
       }
     }
   
-    $this->checked = $checks;
     $tmp = $objectclasses;
-    $not_checked = array();
-    foreach($tmp as $name => $val){
-      $desc = "no description.";
-      if(preg_match("/DESC/",$val)){ 
-        $desc = preg_replace("/^.*DESC[ ]*'/i","",$val) ;
-        $desc = preg_replace("/'.*$/i","",$desc) ;
-      }  
-      $not_checked[$name] = $desc;
+
+    /* Depending on selected rfc2307bis mode, we need different schema configurations */
+    $rfc2307bis = $this->parent->captured_values['rfc2307bis'];
+
+
+    /* The gosa base schema */
+    $checks['posixGroup'] = $def_check;
+    $checks['posixGroup']['REQUIRED_VERSION'] = "2.4";
+    $checks['posixGroup']['SCHEMA_FILES']     = array("gosa+samba3.schema","gosa.schema");
+    $checks['posixGroup']['CLASSES_REQUIRED'] = array("posixGroup");
+    $checks['posixGroup']['STATUS']           = TRUE;
+    $checks['posixGroup']['IS_MUST_HAVE']     = TRUE;
+    $checks['posixGroup']['MSG']              = "";
+    $checks['posixGroup']['INFO']             = "";
+
+    if(isset($tmp['posixGroup'])){
+
+      if($rfc2307bis && isset($tmp['posixGroup']['STRUCTURAL'])){
+        $checks['posixGroup']['STATUS']           = FALSE;
+        $checks['posixGroup']['MSG']              = _("You have enabled the rfc2307bis option on the 'ldap setup' step, but your schema configuration do not support this option.");
+        $checks['posixGroup']['INFO']             = _("In order to use rfc2307bis conform groups the objectClass 'posixGroup' must be AUXILIARY");
+      }
+      if(!$rfc2307bis && !isset($tmp['posixGroup']['STRUCTURAL'])){
+        $checks['posixGroup']['STATUS']           = FALSE;
+        $checks['posixGroup']['MSG']              = _("You have disabled the rfc2307bis option on the 'ldap setup' step, but your schema configuration do not support this option.");
+        $checks['posixGroup']['INFO']             = _("The objectClass 'posixGroup' must be STRUCTURAL");
+      }
     }
 
-    $this->not_checked = $not_checked;  
+    $this->checked = $checks;
   }
 }