From: cajus Date: Mon, 8 May 2006 09:51:23 +0000 (+0000) Subject: Made create_missing_trees gosaUnitTag aware. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4cef45480a333b18d403c243c5433d24722cbb18;p=gosa.git Made create_missing_trees gosaUnitTag aware. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3217 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/TODO b/TODO index c0eb1877e..007a5b5ad 100644 --- 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 diff --git a/include/class_ldap.inc b/include/class_ldap.inc index cd615717e..f8546bdf7 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -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: