From 4e98acfccac4f0e780f4e848df23fb0ab487d4ec Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 28 Nov 2008 10:29:58 +0000 Subject: [PATCH] Updated multiple remove for departments -Do not remove deps twice git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13066 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../departments/class_departmentManagement.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gosa-core/plugins/admin/departments/class_departmentManagement.inc b/gosa-core/plugins/admin/departments/class_departmentManagement.inc index a6118c398..7637f1c38 100644 --- a/gosa-core/plugins/admin/departments/class_departmentManagement.inc +++ b/gosa-core/plugins/admin/departments/class_departmentManagement.inc @@ -225,12 +225,23 @@ class departmentManagement extends plugin /* Confirmation for deletion has been passed. Users should be deleted. */ if (isset($_POST['delete_multiple_department_confirm'])){ + /* Do not remove departments that will already be deleted by its parents + */ + foreach($this->dns as $key => $dn){ + foreach($this->dns as $key2 => $dn2){ + if($dn == $dn2) continue; + if(preg_match("/".preg_quote($dn,'/')."$/",$dn2)){ + unset($this->dns[$key2]); + } + } + } + /* Remove user by user and check acls before removeing them */ foreach($this->dns as $key => $dn){ $acl = $this->ui->get_permissions($dn,"department/department"); if (preg_match('/d/', $acl)){ - /* Delete request is permitted, perform LDAP action */ + /* Delete request is permitted, perform LDAP action */ $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $dn,"department"); $this->deptabs->set_acl_base(); $this->deptabs->delete (); -- 2.30.2