Code

Added check to prevent removing used profiles
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Jun 2007 10:43:03 +0000 (10:43 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Jun 2007 10:43:03 +0000 (10:43 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6662 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_kioskManagementDialog.inc

index 3288c47921bb8279205500485bbdcf9da9e3e570..f6d2295cf593c335bf7bb3715756ead56346c42a 100644 (file)
@@ -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{