Code

Updated tagging
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Jan 2008 16:55:25 +0000 (16:55 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Jan 2008 16:55:25 +0000 (16:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8372 594d385d-05f5-0310-b6e9-bd551577e9d8

24 files changed:
gosa-core/include/class_plugin.inc
gosa-core/plugins/admin/acl/tabs_acl_role.inc
gosa-core/plugins/admin/applications/tabs_application.inc
gosa-core/plugins/admin/departments/class_departmentGeneric.inc
gosa-core/plugins/admin/devices/tabs_devices.inc
gosa-core/plugins/admin/fai/class_faiHook.inc
gosa-core/plugins/admin/fai/class_faiPackage.inc
gosa-core/plugins/admin/fai/class_faiPartitionTable.inc
gosa-core/plugins/admin/fai/class_faiProfile.inc
gosa-core/plugins/admin/fai/class_faiScript.inc
gosa-core/plugins/admin/fai/class_faiTemplate.inc
gosa-core/plugins/admin/fai/class_faiVariable.inc
gosa-core/plugins/admin/groups/tabs_group.inc
gosa-core/plugins/admin/mimetypes/tabs_mimetypes.inc
gosa-core/plugins/admin/ogroups/tabs_ogroups.inc
gosa-core/plugins/admin/systems/class_printGeneric.inc
gosa-core/plugins/admin/systems/tabs_component.inc
gosa-core/plugins/admin/systems/tabs_phone.inc
gosa-core/plugins/admin/systems/tabs_printers.inc
gosa-core/plugins/admin/systems/tabs_server.inc
gosa-core/plugins/admin/systems/tabs_terminal.inc
gosa-core/plugins/admin/systems/tabs_winstation.inc
gosa-core/plugins/admin/systems/tabs_workstation.inc
gosa-core/plugins/personal/generic/class_user.inc

index 29e8840407e5939715e251d16936ae9336ba17c0..346699bad1097b73fc8fb4655b2598460299b984 100644 (file)
@@ -364,6 +364,8 @@ class plugin
       }
     }
 
+    /* Handle tagging */
+    $this->tag_attrs(&$this->attrs);
   }
 
 
@@ -987,13 +989,8 @@ class plugin
     }
   }
 
-
-  function handle_object_tagging($dn= "", $tag= "", $show= false)
+  function tag_attrs($at, $dn= "", $tag= "", $show= false)
   {
-    //FIXME: How to optimize this? We have at least two
-    //       LDAP accesses per object. It would be a good
-    //       idea to have it integrated.
-
     /* No dn? Self-operation... */
     if ($dn == ""){
       $dn= $this->dn;
@@ -1031,71 +1028,17 @@ class plugin
       }
     }
 
+    /* Remove tags that may already be here... */
+    remove_objectClass("gosaAdministrativeUnitTag", &$at);
+    if (isset($at['gosaUnitTag'])){
+        unset($at['gosaUnitTag']);
+    }
 
     /* Set tag? */
     if ($tag != ""){
-      /* Set objectclass and attribute */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
-      $attrs= $ldap->fetch();
-      if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){
-        if ($show) {
-          echo sprintf(_("Object '%s' is already tagged"), @LDAP::fix($dn))."<br>";
-          flush();
-        }
-        return;
-      }
-      if (count($attrs)){
-        if ($show){
-          echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."<br>";
-          flush();
-        }
-        $nattrs= array("gosaUnitTag" => $tag);
-        $nattrs['objectClass']= array();
-        for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
-          $oc= $attrs['objectClass'][$i];
-          if ($oc != "gosaAdministrativeUnitTag"){
-            $nattrs['objectClass'][]= $oc;
-          }
-        }
-        $nattrs['objectClass'][]= "gosaAdministrativeUnitTag";
-        $ldap->cd($dn);
-        $ldap->modify($nattrs);
-        show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn));
-      } else {
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not tagging ($tag) $dn - seems to have moved away", "Tagging");
-      }
-
-    } else {
-      /* Remove objectclass and attribute */
-      $ldap= $this->config->get_ldap_link();
-      $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
-      $attrs= $ldap->fetch();
-      if (isset($attrs['objectClass']) && !in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])){
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "$dn is not tagged", "Tagging");
-        return;
-      }
-      if (count($attrs)){
-        if ($show){
-          echo sprintf(_("Removing tag from object '%s'"), @LDAP::fix($dn))."<br>";
-          flush();
-        }
-        $nattrs= array("gosaUnitTag" => array());
-        $nattrs['objectClass']= array();
-        for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
-          $oc= $attrs['objectClass'][$i];
-          if ($oc != "gosaAdministrativeUnitTag"){
-            $nattrs['objectClass'][]= $oc;
-          }
-        }
-        $ldap->cd($dn);
-        $ldap->modify($nattrs);
-        show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn));
-      } else {
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging");
-      }
+      add_objectClass("gosaAdministrativeUnitTag", &$at);
+      $at['gosaUnitTag']= $tag;
     }
-
   }
 
 
index 3c119d164098a09553f128d1143a1f099d995dcd..1d8c006b10d1fefc7ca36a4e9453c85fe3f0b5f3 100644 (file)
@@ -31,10 +31,6 @@ class aclroletab extends tabs
 
     $ret= tabs::save();
 
-    /* Fix tagging if needed */
-    $baseobject->dn= $new_dn;
-    $baseobject->handle_object_tagging();
-
     return $ret;
   }
 
index 23d2f39ad0163ae29ffa9c89600d3a79d222aa0a..5b6e82989e9129b09615e9bd925f06f9a4bd92b8 100644 (file)
@@ -52,10 +52,6 @@ class apptabs extends tabs
     }
 
     tabs::save();
-
-    /* Fix tagging if needed */
-    $baseobject->dn= $this->dn;
-    $baseobject->handle_object_tagging();
   }
 
 }
index e1d637d15b48c5c38f7e6e63a7a6d88a63351f80..03cedf2dc19ecc5fbd78bf9da26c721a89eb62d5 100644 (file)
@@ -380,11 +380,6 @@ class department extends plugin
       /* The parameter forces only to set must_be_tagged, and don't touch any objects 
          This will be done later */
       $this->tag_objects(true);
-
-      /* Fix tagging if needed */
-      if (!$this->is_administrational_unit){
-        $this->handle_object_tagging();
-      }
     }
     
     /* Optionally execute a command after we're done */
@@ -429,53 +424,53 @@ class department extends plugin
       echo "<h3>".sprintf(_("Tagging '%s'."),"<i>".@LDAP::fix($this->dn)."</i>")."</h3>";
     }
 
-               $add= $this->is_administrational_unit;
-               $len= strlen($this->dn);
-               $ldap= $this->config->get_ldap_link();
-               $ldap->cd($this->dn);
-               if ($add){
-                       $ldap->search('(!(&(objectClass=gosaAdministrativeUnitTag)(gosaUnitTag='.
-                                                               $this->gosaUnitTag.')))', array('dn'));
-               } else {
-                       $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn'));
-               }
-
-               while ($attrs= $ldap->fetch()){
-
-                       /* Skip self */
-                       if ($attrs['dn'] == $this->dn){
-                               continue;
-                       }
-
-                       /* Check for confilicting administrative units */
-                       $fix= true;
-                       foreach ($this->config->adepartments as $key => $tag){
-                               /* This one is shorter than our dn, its not relevant... */
-                               if ($len >= strlen($key)){
-                                       continue;
-                               }
-
-                               /* This one matches with the latter part. Break and don't fix this entry */
-                               if (preg_match('/(^|,)'.normalizePreg($key).'$/', $attrs['dn'])){
-                                       $fix= false;
-                                       break;
-                               }
-                       }
+    $add= $this->is_administrational_unit;
+    $len= strlen($this->dn);
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    if ($add){
+           $ldap->search('(!(&(objectClass=gosaAdministrativeUnitTag)(gosaUnitTag='.
+                                                   $this->gosaUnitTag.')))', array('dn'));
+    } else {
+           $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn'));
+    }
 
-      /* Fix entry if needed */
-      if ($fix){
-        if($OnlySetTagFlag){
-          $this->must_be_tagged =true;
-          return;
-        }
-                               $this->handle_object_tagging($attrs['dn'], $this->gosaUnitTag, TRUE );
-                       }
-               }
+    while ($attrs= $ldap->fetch()){
+
+           /* Skip self */
+           if ($attrs['dn'] == $this->dn){
+                   continue;
+           }
+
+           /* Check for confilicting administrative units */
+           $fix= true;
+           foreach ($this->config->adepartments as $key => $tag){
+                   /* This one is shorter than our dn, its not relevant... */
+                   if ($len >= strlen($key)){
+                           continue;
+                   }
+
+                   /* This one matches with the latter part. Break and don't fix this entry */
+                   if (preg_match('/(^|,)'.normalizePreg($key).'$/', $attrs['dn'])){
+                           $fix= false;
+                           break;
+                   }
+           }
+
+           /* Fix entry if needed */
+           if ($fix){
+                   if($OnlySetTagFlag){
+                           $this->must_be_tagged =true;
+                           return;
+                   }
+                   $this->handle_object_tagging($attrs['dn'], $this->gosaUnitTag, TRUE );
+           }
+    }
     if(!$OnlySetTagFlag){
-      echo '<p class="seperator">&nbsp;</p>';
-      echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
-        <br><input type='submit' name='back' value='"._("Continue")."'>
-        </form></div>";
+           echo '<p class="seperator">&nbsp;</p>';
+           echo "<div style='width:100%;text-align:right;'><form name='form' method='post' action='?plug=".$_GET['plug']."' target='_parent'>
+                   <br><input type='submit' name='back' value='"._("Continue")."'>
+                   </form></div>";
     }
        }
 
@@ -605,6 +600,113 @@ class department extends plugin
                     "facsimileTelephoneNumber" => _("Fax"))
                   ));
   }
+
+  function handle_object_tagging($dn= "", $tag= "", $show= false)
+  {
+    /* No dn? Self-operation... */
+    if ($dn == ""){
+      $dn= $this->dn;
+
+      /* No tag? Find it yourself... */
+      if ($tag == ""){
+        $len= strlen($dn);
+
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "No tag for $dn - looking for one...", "Tagging");
+        $relevant= array();
+        foreach ($this->config->adepartments as $key => $ntag){
+
+          /* This one is bigger than our dn, its not relevant... */
+          if ($len <= strlen($key)){
+            continue;
+          }
+
+          /* This one matches with the latter part. Break and don't fix this entry */
+          if (preg_match('/(^|,)'.normalizePreg($key).'$/', $dn)){
+            @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "DEBUG: Possibly relevant: $key", "Tagging");
+            $relevant[strlen($key)]= $ntag;
+            continue;
+          }
+
+        }
+
+        /* If we've some relevant tags to set, just get the longest one */
+        if (count($relevant)){
+          ksort($relevant);
+          $tmp= array_keys($relevant);
+          $idx= end($tmp);
+          $tag= $relevant[$idx];
+          $this->gosaUnitTag= $tag;
+        }
+      }
+    }
+
+    /* Set tag? */
+    if ($tag != ""){
+      /* Set objectclass and attribute */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
+      $attrs= $ldap->fetch();
+      if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){
+        if ($show) {
+          echo sprintf(_("Object '%s' is already tagged"), @LDAP::fix($dn))."<br>";
+          flush();
+        }
+        return;
+      }
+      if (count($attrs)){
+        if ($show){
+          echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."<br>";
+          flush();
+        }
+        $nattrs= array("gosaUnitTag" => $tag);
+        $nattrs['objectClass']= array();
+        for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
+          $oc= $attrs['objectClass'][$i];
+          if ($oc != "gosaAdministrativeUnitTag"){
+            $nattrs['objectClass'][]= $oc;
+          }
+        }
+        $nattrs['objectClass'][]= "gosaAdministrativeUnitTag";
+        $ldap->cd($dn);
+        $ldap->modify($nattrs);
+        show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn));
+      } else {
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not tagging ($tag) $dn - seems to have moved away", "Tagging");
+      }
+
+    } else {
+      /* Remove objectclass and attribute */
+      $ldap= $this->config->get_ldap_link();
+      $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
+      $attrs= $ldap->fetch();
+      if (isset($attrs['objectClass']) && !in_array_ics("gosaAdministrativeUnitTag", $attrs['objectClass'])){
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "$dn is not tagged", "Tagging");
+        return;
+      }
+      if (count($attrs)){
+        if ($show){
+          echo sprintf(_("Removing tag from object '%s'"), @LDAP::fix($dn))."<br>";
+          flush();
+        }
+        $nattrs= array("gosaUnitTag" => array());
+        $nattrs['objectClass']= array();
+        for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
+          $oc= $attrs['objectClass'][$i];
+          if ($oc != "gosaAdministrativeUnitTag"){
+            $nattrs['objectClass'][]= $oc;
+          }
+        }
+        $ldap->cd($dn);
+        $ldap->modify($nattrs);
+        show_ldap_error($ldap->get_error(), sprintf(_("Handle object tagging with dn '%s' failed."),$dn));
+      } else {
+        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging");
+      }
+    }
+
+  }
+
 }
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 97316ddd21bb1100018d5fea142adef618be5457..0feddfc4eaab39583ae0e401fb5764605f65735f 100644 (file)
@@ -31,11 +31,6 @@ class devicetabs extends tabs
     }
 
     tabs::save();
-
-    /* Fix tagging if needed */
-    $baseobject->dn= $this->dn;
-    $baseobject->handle_object_tagging();
-    $this->by_object['deviceGeneric'] = $baseobject;
   }
 
 }
index f65d06d1c1d1bafe4427f7430c39000061d0784c..fb64e5d3c56c4e18dc73e245477d5335459b6bcb 100644 (file)
@@ -465,9 +465,6 @@ class faiHook extends plugin
       new log("create","fai/".get_class($this),$this->dn,$this->attributes);
     }
 
-    /* Do object tagging */
-    $this->handle_object_tagging();
-
     $ldap->cd($this->dn);
 
     /* Prepare FAIscriptEntry to write it to ldap
@@ -525,16 +522,8 @@ class faiHook extends plugin
         }
       }
 
-      /* 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";
-          }
-        }
-      }
+      /* Tag object */
+      $this->tag_attrs(&$tmp, $sub_dn, $this->gosaUnitTag);
 
       if($obj['status'] == "delete"){
         FAI::prepare_to_save_FAI_object($sub_dn,array(),true);
@@ -546,7 +535,6 @@ class faiHook extends plugin
         FAI::prepare_to_save_FAI_object($sub_dn,$tmp);
         $this->handle_post_events("add");
       }
-      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
     }
   }
 
index 9938e2142db0430c9f470ef403e23f32cf49e4fb..6d6826222ac9033f172d69f72a0825c457ed1687 100644 (file)
@@ -501,8 +501,6 @@ class faiPackage extends plugin
       new log("create","fai/".get_class($this),$this->dn,$this->attributes);
     }
 
-    /* Do object tagging */
-    $this->handle_object_tagging();
     $ldap->cd($this->dn);
 
     /* Save Package configurations */
@@ -524,21 +522,12 @@ class faiPackage extends plugin
         $pkgattrs['FAIvariableContent']   = $attr['Value'];
         $pkgdn =  "FAIvariable=".$name.",".$this->dn;
 
-        /* cehck if object already exists */
-        $ldap->cat($pkgdn,array("objectClass"));
-
-        /* Workaround for missing "gosaAdministrativeUnitTag" */
-        $attrs = $ldap->fetch();
-        if((isset($attrs['objectClass'])) && (in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass']))){
-          $pkgattrs['objectClass'][] = "gosaAdministrativeUnitTag";
-        }
+       /* Tag object */
+       $this->tag_attrs(&$pkgattrs, $pkgdn, $this->gosaUnitTag);
 
         if(in_array($pkgattrs['FAIvariableType'],array("boolean","multiselect","password","select","string","text"))){
           FAI::prepare_to_save_FAI_object($pkgdn,$pkgattrs);
         }
-  
-        /* Handle tagging */
-        $this->handle_object_tagging($pkgdn, $this->gosaUnitTag);
       }
     }
   }
index 1b4931ca76ea13961c0fb5649036d50b4c1dc873..99417316ef67624c8a4e2bbec8a979b8e1f565ac 100644 (file)
@@ -423,9 +423,6 @@ class faiPartitionTable extends plugin
       new log("create","fai/".get_class($this),$this->dn,$this->attributes);
     }
  
-    /* Do object tagging */
-    $this->handle_object_tagging();
-  
     /* Sort entries, because we must delete entries with status="delete" first */
     $order = array();
     foreach($this->disks as $key => $disk){
@@ -453,12 +450,8 @@ class faiPartitionTable extends plugin
         }
       }
 
-      /* Fix problem with missing objectClass "gosaAdministrativeUnitTag" for disks */
-      $ldap->cat($disk_dn,array("objectClass"));
-      $attrs = $ldap->fetch();
-      if(isset($attrs['objectClass']) && in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
-        $disk_attrs['objectClass'][] = "gosaAdministrativeUnitTag";
-      }
+      /* Tag object */
+      $this->tag_attrs(&$disk_attrs, $disk_dn, $this->gosaUnitTag);
 
       if($disk['status'] == "delete"){
         FAI::prepare_to_save_FAI_object($disk_dn,array(),true);
@@ -471,8 +464,6 @@ class faiPartitionTable extends plugin
         $this->handle_post_events("add");
       }
 
-      $this->handle_object_tagging($disk_dn, $this->gosaUnitTag);
-
       if($disk['status']!="delete")
       /* Add all partitions */
       foreach($disk['partitions'] as $key => $partition){
@@ -504,12 +495,8 @@ class faiPartitionTable extends plugin
           $partition_attrs['FAImountPoint']="swap";
         }
 
-        /* Fix problem with missing objectClass "gosaAdministrativeUnitTag" for partitions */
-        $ldap->cat($partition_dn,array("objectClass"));
-        $attrs = $ldap->fetch();
-        if(isset($attrs['objectClass']) && in_array_ics("gosaAdministrativeUnitTag",$attrs['objectClass'])){
-          $partition_attrs['objectClass'][] = "gosaAdministrativeUnitTag";
-        }
+       /* Tag object */
+       $this->tag_attrs(&$partition_attrs, $partition_dn, $this->gosaUnitTag);
 
         if($partition['status'] == "delete"){
           FAI::prepare_to_save_FAI_object($partition_dn,array(),true);
@@ -521,8 +508,6 @@ class faiPartitionTable extends plugin
           FAI::prepare_to_save_FAI_object($partition_dn,$partition_attrs);
           $this->handle_post_events("add");
         }
-
-        $this->handle_object_tagging($partition_dn, $this->gosaUnitTag);
       }
     }
     $this->handle_post_events("add");
index cd325b47524bafa0cd4856729930e61b44b9aa6a..3eaa08b5e2f12ad61595284fab5c8a08c2e840a1 100644 (file)
@@ -449,10 +449,6 @@ class faiProfile extends plugin
     }
  
     show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn));
-
-    /* Do object tagging */
-    $this->handle_object_tagging();
-    show_ldap_error($ldap->get_error(), sprintf(_("Saving of FAI/profile with dn '%s' failed."),$this->dn));
   }
 
 
index 68a58e0160f47b968e18814d49d4a06abe184ab9..2233b6ae6c6ca8ec9808a75ca040d5150bb9fdb2 100644 (file)
@@ -512,9 +512,6 @@ class faiScript extends plugin
       new log("create","fai/".get_class($this),$this->dn,$this->attributes);
     }
 
-    /* Do object tagging */
-    $this->handle_object_tagging();
-
     /* Prepare FAIscriptEntry to write it to ldap
      * First sort array.
      *  Because we must delete old entries first.
@@ -575,16 +572,8 @@ class faiScript extends plugin
         $tmp['FAIpriority']  ="0";
       }
 
-      /* 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";
-          }
-        }
-      }
+      /* Tag object */
+      $this->tag_attrs(&$tmp, $sub_dn, $this->gosaUnitTag);
 
       if($obj['status'] == "delete"){
         FAI::prepare_to_save_FAI_object($sub_dn,array(),true);
@@ -596,8 +585,6 @@ class faiScript extends plugin
         FAI::prepare_to_save_FAI_object($sub_dn,$tmp);
         $this->handle_post_events("add");
       }
-
-      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
     }
   }
 
index b13104b30951edb45e5bb91a44d3a12a618d64a6..54bd8326728984c69c5e1cc89dc396f02a1301cd 100644 (file)
@@ -443,9 +443,6 @@ class faiTemplate extends plugin
       new log("create","fai/".get_class($this),$this->dn,$this->attributes);
     }
 
-    /* Do object tagging */
-    $this->handle_object_tagging();
-
     /* Prepare FAIscriptEntry to write it to ldap
      * First sort array.
      *  Because we must delete old entries first.
@@ -494,16 +491,8 @@ class faiTemplate extends plugin
         }
       }
 
-       /* 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";
-          }
-        }
-      }
+      /* Tag object */
+      $this->tag_attrs(&$tmp, $sub_dn, $this->gosaUnitTag);
 
       if($obj['status'] == "delete"){
         FAI::prepare_to_save_FAI_object($sub_dn,array(),true);
@@ -516,8 +505,6 @@ class faiTemplate extends plugin
         $this->handle_post_events("add");
       }
 
-
-      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
     }
   }
 
index 278710e72ff6ebf328f5a3e606d775a32546b554..7229e3634c56fc752078220ed95e0910109a1e5d 100644 (file)
@@ -345,9 +345,6 @@ class faiVariable extends plugin
       new log("create","fai/".get_class($this),$this->dn,$this->attributes);
     }
  
-    /* Do object tagging */
-    $this->handle_object_tagging();
     /* Prepare FAIscriptEntry to write it to ldap
      * First sort array.
      *  Because we must delete old entries first.
@@ -390,16 +387,8 @@ class faiVariable extends plugin
         }
       }
 
-      /* 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";
-          }
-        }
-      }
+      /* Tag object */
+      $this->tag_attrs(&$tmp, $sub_dn, $this->gosaUnitTag);
       
       if($obj['status'] == "delete"){
         FAI::prepare_to_save_FAI_object($sub_dn,array(),true);
@@ -412,7 +401,6 @@ class faiVariable extends plugin
         $this->handle_post_events("add");
       }
 
-      $this->handle_object_tagging($sub_dn, $this->gosaUnitTag);
     }
   }
 
index 094551de9d0bc5eafbb83cb537555c682607779c..af212368c30299b1a4dad4d13286af75d3cb9f64 100644 (file)
@@ -73,10 +73,6 @@ class grouptabs extends tabs
 
                $ret= tabs::save();
 
-               /* Fix tagging if needed */
-               $baseobject->dn= $new_dn;
-               $baseobject->handle_object_tagging();
-
                return $ret;
        }
 
index 9e93bb411465796da612ca7a8bcc9cdb5c58540f..38570fde21c1fca85031a66d982757d9f95b39e6 100644 (file)
@@ -54,11 +54,6 @@ class mimetabs extends tabs
     }
 
     tabs::save();
-
-    /* Fix tagging if needed */
-    $baseobject->dn= $this->dn;
-    $baseobject->handle_object_tagging();
-    $this->by_object['mimetype'] = $baseobject;
   }
 
 }
index 6d3c018af5701249122f96eaa6bbeb1385339804..3cbeccd92639f7a3222adbc534e5b9e0e2c57cf3 100644 (file)
@@ -292,10 +292,6 @@ class ogrouptabs extends tabs
     }
 
     tabs::save();
-
-    /* Fix tagging if needed */
-               $baseobject->dn= $new_dn;
-    $baseobject->handle_object_tagging();
   }
 
   function getCopyDialog()
index 8940a9356a0b0b0000745793a159796802162943..9eec1acaf323d9ca82040d16ff8b31c992dd7c84 100644 (file)
@@ -867,9 +867,6 @@ class printgeneric extends plugin
       $this->netConfigDNS->dn = $this->dn;
       $this->netConfigDNS->save();
     }
-
-    /* This is a multi object. Handle tagging here... */
-    $this->handle_object_tagging();
   }
 
   function generateList(){
index c195da845b7edf901ac19c501211c158d2880d4c..ff0c69d9a9543ad536203e9170a34c9397248aa6 100644 (file)
@@ -30,9 +30,6 @@ class componenttabs extends tabs
     }
 
     tabs::save(TRUE);
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
   }
 
 }
index 3967b423054df2af75303744a7560b111bc13fd1..fbf11071a1f8f64b31d15598c99322ead080dab2 100644 (file)
@@ -30,9 +30,6 @@ class phonetabs extends tabs
     }
 
     tabs::save(TRUE);
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
   }
 
 }
index 3142146b0765f01adfde8188af3ec52d027a2ce3..739777a7ed8e4a5cb7239023cfdd7e04426ac08b 100644 (file)
@@ -54,9 +54,6 @@ class printtabs extends tabs
     }
 
     tabs::save(FALSE);
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
   }
 
 }
index 5ee27ab39b803db21d29de0f36be65ceaea69ffa..322851b61638a8a2167d70cb6fd27175cc197391 100644 (file)
@@ -59,9 +59,6 @@ class servtabs extends tabs
     $config = session::get('config');
     $config->load_servers();
     session::set('config',$config);
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
   }
 
 }
index 9f602e3709a1a1f461b43f365df74b1c9ee0abcc..ea9207faf4b6433982241105e963f5255d1c3373 100644 (file)
@@ -69,9 +69,6 @@ class termtabs extends tabs
         $this->by_object['printgeneric']->remove_from_parent();
       }
     }
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
   }
 
 }
index cada48b8034fbce207836de5f0af9901cebfbce7..3adcb2de699ac04fcad9485ce4211703488d363f 100644 (file)
@@ -36,9 +36,6 @@ class wintabs extends tabs
     }
 
     tabs::save(TRUE);
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
   }
 
 }
index 5660acb29ebfb744805739d32ecc951860cf66a6..3d6bac27c5134dcca4e9f1a8308fcac61a13ef84 100644 (file)
@@ -67,9 +67,6 @@ class worktabs extends tabs
         $this->by_object['printgeneric']->remove_from_parent();
       }
     }
-
-    /* Fix tagging if needed */
-    $baseobject->handle_object_tagging();
   }
 
 }
index ee7da75d697bcadf7fedbdbb6a9a3611bcf25959..9e75338d044fe3e32cbc85c694559857681fcbbb 100644 (file)
@@ -1052,9 +1052,6 @@ class user extends plugin
       $this->handle_post_events("modify", array("uid" => $this->uid));
     }
 
-    /* Fix tagging if needed */
-    $this->handle_object_tagging();
-
     return (0);
   }