Code

Fixes "gosaAdministrativeUnitTag" problem for Templates / Variables
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 May 2006 09:07:41 +0000 (09:07 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 May 2006 09:07:41 +0000 (09:07 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3263 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiTemplate.inc
plugins/admin/fai/class_faiVariable.inc

index 9ba26c6496b89a5464ce9b30ffd237f0d199d7fa..a8be5fe48360953a8b36a412e3aa802d03cb082e 100644 (file)
@@ -308,7 +308,7 @@ class faiTemplate 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);
@@ -363,9 +363,20 @@ class faiTemplate 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";
+          $obj['status']="edited";
+        }
+      }
+
+       /* Check if gosaAdministrativeUnitTag is required as object class */
+      if($obj['status'] == "edited"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        $attrs = $ldap->fetch();
+        if(isset($attrs['objectClass'])){
+          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
+            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
+          }
         }
       }
 
index 4a901123ea6128c0fc6f4884ff01dce789cb74d6..e49419096ec94de4bcd165ccc6e5f495c1fb99cf 100644 (file)
@@ -277,7 +277,7 @@ class faiVariable 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);
@@ -333,9 +333,20 @@ $ldap->modify ($this->attrs);
       $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";
+          $obj['status']="edited";
+        }
+      }
+
+      /* Check if gosaAdministrativeUnitTag is required as object class */
+      if($obj['status'] == "edited"){
+        $ldap->cat($sub_dn,array("objectClass"));
+        $attrs = $ldap->fetch();
+        if(isset($attrs['objectClass'])){
+          if(in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
+            $tmp['objectClass'][] = "gosaAdministrativeUnitTag";
+          }
         }
       }