Code

Added mailqueue acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 1 Dec 2005 10:21:46 +0000 (10:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 1 Dec 2005 10:21:46 +0000 (10:21 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2173 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/mailqueue/class_mailqueue.inc
plugins/addons/mailqueue/main.inc
plugins/admin/groups/acl_definition.inc

index afaa9038697fac4f493fec479695520f0decec98..4dca13deeae9df3097315b5cebb53e63764ada73 100644 (file)
@@ -74,13 +74,19 @@ class mailqueue extends plugin
       foreach(array("unhold_all","hold_all","del_all","requeue_all") as $attr){
         foreach($_POST as $name => $value){
           if((preg_match("/".$attr."/",$name))&&($only_once)){
-            $only_once = false;
-            $act = preg_replace("/_.*$/i","",$attr);
-            $r_cmd = preg_replace("/%action/" , $act           ,$this->mailQueueScript);
-            $r_cmd = preg_replace("/%server/" , $se_str         ,$r_cmd);
-            $r_cmd = preg_replace("/%id/"     , "ALL"           ,$r_cmd);
-            if($this->pass_cmd($r_cmd)==false){
-              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
+            if(chkacl($this->acl,$attr)!=""){
+              $only_once = false;
+              #FIXME Please choose a better error msg, if release is released
+              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$attr));
+            }else{
+              $only_once = false;
+              $act = preg_replace("/_.*$/i","",$attr);
+              $r_cmd = preg_replace("/%action/" , $act           ,$this->mailQueueScript);
+              $r_cmd = preg_replace("/%server/" , $se_str         ,$r_cmd);
+              $r_cmd = preg_replace("/%id/"     , "ALL"           ,$r_cmd);
+              if($this->pass_cmd($r_cmd)==false){
+                print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
+              }
             }
           }
         }
@@ -97,33 +103,37 @@ class mailqueue extends plugin
         if(in_array($opt,array("unhold","hold","del","requeue","query","header"))){
           $only_once = false;
 
-          /* Create cmd */
-          $r_cmd = preg_replace("/%action/" , $opt            ,$this->mailQueueScript);
-          $r_cmd = preg_replace("/%server/" , $this->Server   ,$r_cmd);
-          $r_cmd = preg_replace("/%id/"     , $_GET['id']     ,$r_cmd);
-
-          /* Execute cmd */
-          if(!$str = $this->pass_cmd($r_cmd)){
-            print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
+          if(chkacl($this->acl,$opt)!=""){
+              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$opt));
           }else{
+            /* Create cmd */
+            $r_cmd = preg_replace("/%action/" , $opt            ,$this->mailQueueScript);
+            $r_cmd = preg_replace("/%server/" , $this->Server   ,$r_cmd);
+            $r_cmd = preg_replace("/%id/"     , $_GET['id']     ,$r_cmd);
+
+            /* Execute cmd */
+            if(!$str = $this->pass_cmd($r_cmd)){
+              print_red(sprintf(_("Please check your 'gosa.conf' the given '%s' can't be executed."),$r_cmd));
+            }else{
+            
+              /* Special handling for option='header' */
+              if($opt == "header"){
           
-            /* Special handling for option='header' */
-            if($opt == "header"){
-        
-              /* Create table which displays the header informations */
-              $this->disp_header ="\n<table width='80%'>";
-              foreach(split("\n",$str) as $line){
-                $line = trim($line);
-                if(empty($line)) {
-                  continue;
-                }
-                $this->disp_header .= "\n<tr>";
-                $tmp0 = preg_replace("/:.*$/","",$line);
-                $tmp1 = preg_replace("/^.*:/","",$line);
-                $this->disp_header .= "\n<td style='background-color:#EEEEEE;'>".$tmp0."</td><td>".$tmp1."</td>"; 
-                $this->disp_header .= "\n</tr>";
-              }              
-              $this->disp_header .= "\n</table>";
+                /* Create table which displays the header informations */
+                $this->disp_header ="\n<table width='80%'>";
+                foreach(split("\n",$str) as $line){
+                  $line = trim($line);
+                  if(empty($line)) {
+                    continue;
+                  }
+                  $this->disp_header .= "\n<tr>";
+                  $tmp0 = preg_replace("/:.*$/","",$line);
+                  $tmp1 = preg_replace("/^.*:/","",$line);
+                  $this->disp_header .= "\n<td style='background-color:#EEEEEE;'>".$tmp0."</td><td>".$tmp1."</td>"; 
+                  $this->disp_header .= "\n</tr>";
+                }              
+                $this->disp_header .= "\n</table>";
+              }
             }
           }
         }
index b9c282534f135aeede288dd7c9800f12cf6221b6..c1214ee2c37c19480f3f1eb3467d226e8d945da3 100644 (file)
@@ -28,6 +28,10 @@ if (!$remove_lock){
        }
        $mailqueue= $_SESSION['mailqueue'];
 
+ /* set permissions */
+    $acl= get_permissions ($ui->dn, $ui->subtreeACL);
+    $mailqueue->acl= get_module_permission($acl, "mailqueue", $ui->dn);
+
        /* Execute formular */
        $mailqueue->save_object();
        $display.= $mailqueue->execute ();
index d8b6d4863f715756a76de6cee527a0cb39a6d986..76033c678f259c65e09dd40438abb58ec5faaf7f 100644 (file)
@@ -290,6 +290,6 @@ $ACLD['addressbook']=  array("addressbook","add", "delete",
 $ACLD['fonreport']     =  array("fonreport", "src", "dst", "channel", "lastapp", "disposition", "duration");
 $ACLD['faxreport']     =  array("faxreport");
 $ACLD['logview']       =  array("logview");
-$ACLD['mailqueue']     =  array("mailqueue");
+$ACLD['mailqueue']     =  array("mailqueue","unhold_all","hold_all","del_all","requeue_all","unhold","hold","del","requeue","query","header");
 $ACLD['ldapmanager']=  array("ldapmanager","import","export","xlsexport","csvimport");
 ?>