From c6caf273ac8fdb923bc84b0b0914b750b6d79f81 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 1 Dec 2005 10:21:46 +0000 Subject: [PATCH] Added mailqueue acls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2173 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/addons/mailqueue/class_mailqueue.inc | 74 +++++++++++--------- plugins/addons/mailqueue/main.inc | 4 ++ plugins/admin/groups/acl_definition.inc | 2 +- 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/plugins/addons/mailqueue/class_mailqueue.inc b/plugins/addons/mailqueue/class_mailqueue.inc index afaa90386..4dca13dee 100644 --- a/plugins/addons/mailqueue/class_mailqueue.inc +++ b/plugins/addons/mailqueue/class_mailqueue.inc @@ -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"; - foreach(split("\n",$str) as $line){ - $line = trim($line); - if(empty($line)) { - continue; - } - $this->disp_header .= "\n"; - $tmp0 = preg_replace("/:.*$/","",$line); - $tmp1 = preg_replace("/^.*:/","",$line); - $this->disp_header .= "\n"; - $this->disp_header .= "\n"; - } - $this->disp_header .= "\n
".$tmp0."".$tmp1."
"; + /* Create table which displays the header informations */ + $this->disp_header ="\n"; + foreach(split("\n",$str) as $line){ + $line = trim($line); + if(empty($line)) { + continue; + } + $this->disp_header .= "\n"; + $tmp0 = preg_replace("/:.*$/","",$line); + $tmp1 = preg_replace("/^.*:/","",$line); + $this->disp_header .= "\n"; + $this->disp_header .= "\n"; + } + $this->disp_header .= "\n
".$tmp0."".$tmp1."
"; + } } } } diff --git a/plugins/addons/mailqueue/main.inc b/plugins/addons/mailqueue/main.inc index b9c282534..c1214ee2c 100644 --- a/plugins/addons/mailqueue/main.inc +++ b/plugins/addons/mailqueue/main.inc @@ -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 (); diff --git a/plugins/admin/groups/acl_definition.inc b/plugins/admin/groups/acl_definition.inc index d8b6d4863..76033c678 100644 --- a/plugins/admin/groups/acl_definition.inc +++ b/plugins/admin/groups/acl_definition.inc @@ -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"); ?> -- 2.30.2