From: hickert Date: Wed, 24 Feb 2010 09:47:03 +0000 (+0000) Subject: Updated plugin class X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=cee9c9c4a8606707c8759343390a9005d8cabcb6;p=gosa.git Updated plugin class -Ensures 'manager' integrity when users are moved. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15682 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 4e5f5656b..e854884a4 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -1037,6 +1037,23 @@ class plugin $role->save(); } } + + // Update 'manager' attributes from gosaDepartment and inetOrgPerson + $filter = "(&(objectClass=inetOrgPerson)(manager=".LDAP::prepare4filter(LDAP::fix($src_dn))."))"; + $ocs = $ldap->get_objectclasses(); + if(isset($ocs['gosaDepartment']['MAY']) && in_array('manager', $ocs['inetOrgPerson']['MAY'])){ + $filter = "(|".$filter."(&(objectClass=gosaDepartment)(manager=".LDAP::prepare4filter(LDAP::fix($src_dn)).")))"; + } + $leaf_deps= get_list($filter,array("all"),$this->config->current['BASE'], + array("manager","dn","objectClass"),GL_SUBSEARCH | GL_NO_ACL_CHECK); + foreach($leaf_deps as $entry){ + $update = array('manager' => $dst_dn); + $ldap->cd($entry['dn']); + $ldap->modify($update); + if(!$ldap->success()){ + trigger_error(sprintf("Failed to update manager for '%s', error was '%s'", $entry['dn'], $ldap->get_error())); + } + } /* Check if there are gosa departments moved. If there were deps moved, the force reload of config->deps.