From: hickert Date: Fri, 22 Jun 2007 10:41:36 +0000 (+0000) Subject: Added check to prevent removing of used profiles X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fb26a98b9accdb355edb43d76037195dfa45112a;p=gosa.git Added check to prevent removing of used profiles git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6661 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/personal/environment/class_kioskManagementDialog.inc b/plugins/personal/environment/class_kioskManagementDialog.inc index 0f28bde89..17bd5d2f4 100644 --- a/plugins/personal/environment/class_kioskManagementDialog.inc +++ b/plugins/personal/environment/class_kioskManagementDialog.inc @@ -47,7 +47,7 @@ class kioskManagementDialog extends plugin $this->filesToAttach[$file['name']]['contents'] = file_get_contents($file['tmp_name']); } } - + $only_once = true; foreach($_POST as $name => $value){ @@ -59,8 +59,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{