From 2a0c76e2c721b62a6d7bff5ee8c6e414e3987b15 Mon Sep 17 00:00:00 2001 From: cajus Date: Tue, 14 Nov 2006 11:21:57 +0000 Subject: [PATCH] Added check to avoid share removal, if it is still used. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5104 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_servService.inc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/admin/systems/class_servService.inc b/plugins/admin/systems/class_servService.inc index 091e98717..123348418 100644 --- a/plugins/admin/systems/class_servService.inc +++ b/plugins/admin/systems/class_servService.inc @@ -99,7 +99,24 @@ class servservice extends plugin } function deleteFromList($id){ - unset($this->goExportEntryList[$id]); + /* Check if the share is used by someone */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*))", array("cn")); + $cnt= $ldap->count(); + if ($cnt){ + $msg= sprintf(_("The share can't be removed since it is still used by %d users:"), $cnt); + $msg.= "

"._("Please correct the share-/profile settings of these users"); + print_red($msg); + + } else { + /* Finally remove it */ + unset($this->goExportEntryList[$id]); + } } function addToMountList($entry) { -- 2.30.2