Code

Fixed Hook "gosaAdministrativeUnitTag" problem
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 May 2006 08:58:05 +0000 (08:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 May 2006 08:58:05 +0000 (08:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3261 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiHook.inc

index 3fba9649cb826bbe96ba91b513e24ebe9ed7b38b..4caa9d0e2b3aeabbb7adf92029309fab7aab301e 100644 (file)
@@ -365,7 +365,7 @@ class faiHook extends plugin
 
     $ldap = $this->config->get_ldap_link();
 
-    $ldap->cat($this->dn);
+    $ldap->cat($this->dn,array("objectClass"));
     if($ldap->count()!=0){     
       /* Write FAIscript to ldap*/ 
       $ldap->cd($this->dn);
@@ -427,12 +427,23 @@ class faiHook extends plugin
       $sub_dn = "cn=".$obj['cn'].",".$this->dn;
 
       if($obj['status']=="new"){
-        $ldap->cat($sub_dn);
+        $ldap->cat($sub_dn,array("objectClass"));
         if($ldap->count()){
           $obj['status']="modify";
         }
       }
 
+      /* Check if gosaAdministrativeUnitTag is required as object class */
+      if($obj['status'] == "modify"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        $attrs = $ldap->fetch();
+        if(isset($attrs['objectClass'])){
+          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
+            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
+          }
+        }
+      }
+
       if($obj['status'] == "delete"){
         $ldap->cd($sub_dn);
         $ldap->rmdir_recursive($sub_dn);
@@ -441,7 +452,6 @@ class faiHook extends plugin
         $ldap->cd($sub_dn);
         $this->cleanup();
         $ldap->modify ($tmp); 
-
         $this->handle_post_events("modify");
       }elseif($obj['status']=="new"){
         if($tmp['description']==array()){