Commit ca8c00c6 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4638 Department cache is wrong after editing a department

Showing with 11 additions and 25 deletions
+11 -25
......@@ -608,13 +608,10 @@ class config {
}
}
/*!
* \brief Store the departments from ldap in $this->departments
*
* \param string $ignore_dn dn of the department
*/
function get_departments($ignore_dn = "")
function get_departments()
{
/* Initialize result hash */
$result = array();
......@@ -629,14 +626,14 @@ class config {
$types = departmentManagement::getDepartmentTypes();
/* Create a list of attributes to fetch */
$filter = "";
$ldap_values = array("objectClass", "description");
$filter = '';
$ldap_values = array('objectClass', 'description');
foreach ($types as $type) {
$i = objects::infos($type);
$filter .= $i['filter'];
$ldap_values[] = $i['mainAttr']; // Specific key for departement objectTypes
}
$filter = "(|".$filter.")";
$filter = '(|'.$filter.')';
/* Get list of department objects */
$ldap = $this->get_ldap_link();
......@@ -660,17 +657,15 @@ class config {
$dn = $ldap->getDN();
$data = objects::infos($oc);
$this->department_info[$dn] = array("img" => $data['icon'],
"description" => isset($attrs['description'][0])?$attrs['description'][0]:"",
"name" => $attrs[$data['mainAttr']][0]);
if ($dn == $ignore_dn) {
continue;
}
$c_dn = convert_department_dn($dn)." (".$data['mainAttr'].")";
$this->department_info[$dn] = array(
'img' => $data['icon'],
'description' => (isset($attrs['description'][0]) ? $attrs['description'][0] : ''),
'name' => $attrs[$data['mainAttr']][0]
);
/* Only assign non-root departments */
if ($dn != $result['/']) {
$c_dn = convert_department_dn($dn).' ('.$data['mainAttr'].')';
$result[$c_dn] = $dn;
}
}
......
......@@ -179,16 +179,6 @@ class department extends simplePlugin
return $message;
}
function execute()
{
/* Reload departments */
$this->config->get_departments($this->dn);
$this->config->make_idepartments();
/* Call parent execute */
return parent::execute();
}
function get_allowed_bases()
{
/* Hide all departments, that are subtrees of this department */
......
......@@ -28,6 +28,7 @@ class deptabs extends simpleTabs
/* Update department cache */
global $config;
$config->get_departments();
$config->make_idepartments();
}
}
?>
  • bmortier @bmortier

    mentioned in issue #1477 (closed)

    By mhamant on 2017-09-02T15:27:33 (imported from GitLab)

    ·

    mentioned in issue #1477 (closed)

    By mhamant on 2017-09-02T15:27:33 (imported from GitLab)

    Toggle commit list
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment