From 9daa665f02338affc0da48bead4a3c5a7c6c6f9e Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 22 Jun 2007 10:43:03 +0000 Subject: [PATCH] Added check to prevent removing used profiles git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6662 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_kioskManagementDialog.inc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/personal/environment/class_kioskManagementDialog.inc b/plugins/personal/environment/class_kioskManagementDialog.inc index 3288c4792..f6d2295cf 100644 --- a/plugins/personal/environment/class_kioskManagementDialog.inc +++ b/plugins/personal/environment/class_kioskManagementDialog.inc @@ -58,8 +58,25 @@ class kioskManagementDialog extends plugin $name = preg_replace("/^.*\//i","",base64_decode($id)); $filename = $this->baseDir."/".$name; + + /* check if profile is still in use */ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(gotoKioskProfile=*lhs.schema*)",array("cn","uid","gotoKioskProfile")); + $used_by = ""; + $cnt = 3; + while(($attrs = $ldap->fetch()) && ($cnt)){ + $cnt --; + $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]); + if($check == $name){ + $used_by .= $attrs['cn'][0].", "; + } + } + $used_by = preg_replace("/, $/","",$used_by); - if(isset($this->filesToAttach[$name])){ + if(!empty($used_by)){ + print_red(sprintf(_("Can't remove kioks profile, it is still in use by the following objects '%s'."),$used_by)); + }elseif(isset($this->filesToAttach[$name])){ unset($this->filesToAttach[$name]); }else{ -- 2.30.2