Code

Made create_missing_trees gosaUnitTag aware.
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 8 May 2006 09:51:23 +0000 (09:51 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 8 May 2006 09:51:23 +0000 (09:51 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3217 594d385d-05f5-0310-b6e9-bd551577e9d8

TODO
include/class_ldap.inc

diff --git a/TODO b/TODO
index c0eb1877ee2d2370f77d13b6cc88715c148b8a73..007a5b5adee5a2dffe3b721974fba752576eb7b3 100644 (file)
--- a/TODO
+++ b/TODO
@@ -28,8 +28,6 @@ Target for 2.4.1:
 
 * Auto-Resize for subdialogs
 
-* Fix create_missing_trees to gererate tags if needed, too
-
 * Fix fai objects to generate tags if needed (sub objects, phone me...)
 
 * Fix Phone book to generate tags if needed
index cd615717e7ef06181d7d3767f1d715cebaecbe62..f8546bdf777bea71d35d447d2b44e66b2ec22d1a 100644 (file)
@@ -638,6 +638,7 @@ class LDAP{
     $l= array_reverse(ldap_explode_dn($real_path,0));
     unset($l['count']);
     $cdn= $this->basedn;
+    $tag= "";
 
     foreach ($l as $part){
       $cdn= "$part,$cdn";
@@ -659,18 +660,35 @@ class LDAP{
       $attrs= $this->fetch();
 
       /* Create missing entry? */
-      if (!count ($attrs)){
+      if (count ($attrs)){
+      
+        /* Catch the tag - if present */
+        if (isset($attrs['gosaUnitTag'][0])){
+          $tag= $attrs['gosaUnitTag'][0];
+        }
+
+      } else {
         $type= preg_replace('/^([^=]+)=.*$/', '\\1', $cdn);
         $param= preg_replace('/^[^=]+=([^,]+),.*$/', '\\1', $cdn);
 
         $na= array();
         switch ($type){
           case 'ou':
-            $na["objectClass"]= "organizationalUnit";
+            if ($tag != ""){
+              $na["objectClass"]= array("organizationalUnit", "gosaAdministrativeUnitTag");
+              $na["gosaUnitTag"]= $tag;
+            } else {
+              $na["objectClass"]= "organizationalUnit";
+            }
             $na["ou"]= $param;
             break;
           case 'dc':
-            $na["objectClass"]= array("dcObject", "top", "locality");
+            if ($tag != ""){
+              $na["objectClass"]= array("dcObject", "top", "locality", "gosaAdministrativeUnitTag");
+              $na["gosaUnitTag"]= $tag;
+            } else {
+              $na["objectClass"]= array("dcObject", "top", "locality");
+            }
             $na["dc"]= $param;
             break;
           default: