Code

Fixed removing, too
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 May 2006 08:57:53 +0000 (08:57 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 May 2006 08:57:53 +0000 (08:57 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3260 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_plugin.inc

index 52a2a03792ba65b58a3cccc26b5d999efc037f2c..c769b8fc32a7a9e52ba2c2901928c293c50ad7de 100644 (file)
@@ -935,18 +935,22 @@ class plugin
         echo "DEBUG: $dn is not tagged<br>";
         return;
       }
-      echo "DEBUG: Remove tagging from $dn.<br>";
-      $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;
+      if (count($attrs)){
+        echo "DEBUG: Remove tagging from $dn.<br>";
+        $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());
+      } else {
+        echo "DEBUG: not removing tag ($tag) $dn - seems to have moved away<br>";
       }
-      $ldap->cd($dn);
-      $ldap->modify($nattrs);
-      show_ldap_error($ldap->get_error());
     }
     
   }