Code

Followup commit for #774
[gosa.git] / trunk / gosa-plugins / fai / admin / fai / class_faiTemplate.inc
index 689d5464bfa856d6dc395d5a5d2cf95af2ca92a3..10c0bd69c5f8a31266939359b8ba5cb8af4c9aea 100644 (file)
@@ -418,6 +418,14 @@ class faiTemplate extends plugin
       }
     }
 
+    if (preg_match("/^-/", $this->cn)) {
+      $message[] = sprintf(_("The specified classname '%s' is invalid. Classnames must not start with a dash."), $this->cn);
+    }
+
+    if($this->cn != preg_replace("/ /","",trim($this->cn))){
+      $message[] = msgPool::invalid(_("Name"),preg_replace("/ /","_",$this->cn),"/[^_]/");
+    }
+
     return ($message);
   }
 
@@ -510,12 +518,8 @@ class faiTemplate extends plugin
 
     /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
      */
-    $res = FAI::get_all_objects_for_given_base($source['dn'],"(&(objectClass=FAIclass)(objectClass=".$this->subClass."))");
+    $res = FAI::get_leaf_objects($source['dn'], $source['cn'][0], $this->subClass, get_ou('faiTemplateRDN'));
     foreach($res as $obj){
-
-      /* Skip not relevant objects */
-      if(!preg_match("/".preg_quote($source['dn'], '/')."$/i",$obj['dn'])) continue;
-
       $objects = array();
       $objects['status']      = "edited";
       $objects['dn']          = $obj['dn'];