Code

Added check to avoid share removal, if it is still used.
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 14 Nov 2006 11:21:57 +0000 (11:21 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 14 Nov 2006 11:21:57 +0000 (11:21 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5104 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servService.inc

index 091e98717f25c66dc67810b112fb7bb8945d3f6d..1233484180d1b477faa62b5abf16a864dea77bcf 100644 (file)
@@ -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.= "<br><br><ul>";
+      while ($attrs= $ldap->fetch()){
+        $msg.= "<li>".$attrs["cn"][0]."</li>";
+      }
+      $msg.= "</ul>"._("Please correct the share-/profile settings of these users");
+      print_red($msg);
+      
+    } else {
+      /* Finally remove it */
+      unset($this->goExportEntryList[$id]);
+    }
   }
   
   function addToMountList($entry) {