Code

Apply patch for #3716
[gosa.git] / trunk / gosa-plugins / fai / admin / fai / class_faiHook.inc
index e71fc1b855f504c9007428c6ab98c1a7d3a75b1e..281b3d6becb09cefa6f5e8447730756398bfd883 100644 (file)
@@ -43,15 +43,9 @@ class faiHook extends plugin
      */
     if($dn != "new"){
       $this->dn =$dn;
-   
-      /* Read all leaf objects of this object (For FAIscript this would be FAIscriptEntry)
-       */
-      $res = FAI::get_all_objects_for_given_base($this->dn,"(&(objectClass=FAIclass)(objectClass=".$this->subClass."))");
-      foreach($res as $obj){
-
-        /* Skip not relevant objects */
-        if(!preg_match("/".preg_quote($this->dn, '/')."$/i",$obj['dn'])) continue;
 
+      $res = FAI::get_leaf_objects($this->dn, $this->cn, $this->subClass, get_ou('faiHookRDN'));
+      foreach($res as $obj){
         $objects = array();
         $objects['status']      = "FreshLoaded";
         $objects['dn']          = $obj['dn'];
@@ -508,7 +502,8 @@ class faiHook extends plugin
       }
 
       /* Tag object */
-      $this->tag_attrs($tmp, $sub_dn, $this->gosaUnitTag);
+      $ui= get_userinfo();
+      $this->tag_attrs($tmp, $sub_dn, $ui->gosaUnitTag);
 
       if($obj['status'] == "delete"){
         FAI::prepare_to_save_FAI_object($sub_dn,array(),true);