summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4b79ccf)
raw | patch | inline | side by side (parent: 4b79ccf)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 26 Jun 2008 08:51:35 +0000 (08:51 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 26 Jun 2008 08:51:35 +0000 (08:51 +0000) |
-Fixed problem with department of same name.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11451 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11451 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_config.inc | patch | blob | history |
index e800b61a90e1cb219d30e79d66d781566a7b33a5..42e0c3dbee493b5b3dda9a6a7e6bf4503b942211 100644 (file)
$result['/']= $this->current['BASE'];
$this->tdepartments= array();
+ /* Get all department types from department Management, to be able detect the department type.
+ -It is possible that differnty department types have the same name,
+ in this case we have to mark the department name to be able to differentiate.
+ (e.g l=Name or o=Name)
+ */
+ $types = departmentManagement::get_support_departments();
+
+ /* Create a list of attributes to fetch */
+ $ldap_values = array("objectClass","gosaUnitTag");
+ $filter = "";
+ foreach($types as $type){
+ $ldap_values[] = $type['ATTR'];
+ $filter .= "(objectClass=".$type['OC'].")";
+ }
+ $filter = "(&(objectClass=gosaDepartment)(|".$filter."))";
+
/* Get list of department objects */
$ldap= $this->get_ldap_link();
$ldap->cd ($this->current['BASE']);
- $ldap->search ("(objectClass=gosaDepartment)", array("ou", "objectClass", "gosaUnitTag"));
+ $ldap->search ($filter, $ldap_values);
while ($attrs= $ldap->fetch()){
+
+ /* Detect department type */
+ $type_data = array();
+ foreach($types as $t => $data){
+ if(in_array($data['OC'],$attrs['objectClass'])){
+ $type_data = $data;
+ break;
+ }
+ }
+
+ /* Unknown department type -> skip
+ */
+ if(!count($type_data)) continue;
+
$dn= $ldap->getDN();
$this->tdepartments[$dn]= "";
continue;
}
+ $c_dn = convert_department_dn($dn)." (".$type_data['ATTR'].")";
+
/* Only assign non-root departments */
if ($dn != $result['/']){
- $result[convert_department_dn($dn)]= $dn;
+ $result[$c_dn]= $dn;
}
}
/* Extract department name */
$elestr = trim(preg_replace("/^[^=]*+=/","", $ele),",");
+ $nameA = trim(preg_replace("/=.*$/","", $ele),",");
+ if($nameA != "ou"){
+ $nameA = " (".$nameA.")";
+ }else{
+ $nameA = "";
+ }
+
/* Add to array */
if($key == (count($elements)-1)){
- $last[$elestr]['ENTRY'] = $val;
+ $last[$elestr.$nameA]['ENTRY'] = $val;
}
/* Set next array appending position */
- $last = &$last[$elestr]['SUB'];
+ $last = &$last[$elestr.$nameA]['SUB'];
}
}
+
/* Add base entry */
$ret["/"]["ENTRY"] = $base;
$ret["/"]["SUB"] = $arr;