From 422703215fbb0638201175c7ce3ee1777f89a694 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 31 Oct 2006 11:58:48 +0000 Subject: [PATCH] Updated acl for mailqueue git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4977 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/addons/mailqueue/class_mailqueue.inc | 39 ++++++++++++++++++-- plugins/addons/mailqueue/main.inc | 8 ++-- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/plugins/addons/mailqueue/class_mailqueue.inc b/plugins/addons/mailqueue/class_mailqueue.inc index 73aa90a76..19268178d 100644 --- a/plugins/addons/mailqueue/class_mailqueue.inc +++ b/plugins/addons/mailqueue/class_mailqueue.inc @@ -80,7 +80,7 @@ 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)){ - if(chkacl($this->acl,$attr)!=""){ + if(!$this->acl_is_readable($attr)){ $only_once = false; print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),$attr)); }else{ @@ -108,7 +108,7 @@ class mailqueue extends plugin if(in_array($opt,array("unhold","hold","del","requeue","query","header"))){ $only_once = false; - if(chkacl($this->acl,$opt)!=""){ + if(!$this->acl_is_readable($opt)){ print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),$opt)); }else{ /* Create cmd */ @@ -167,7 +167,7 @@ class mailqueue extends plugin $q_cmd = preg_replace("/%server/" ,$this->Server,$q_cmd); $q_cmd = preg_replace("/%id/" ,"all" ,$q_cmd); - if(chkacl($this->acl,"query")!=""){ + if(!$this->acl_is_readable("query")){ print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),"query")); $mailQueueParser = new parseMailQueue("",$this->Server); }else{ @@ -194,7 +194,8 @@ class mailqueue extends plugin $q_cmd = preg_replace("/%server/" ,$ServerName ,$q_cmd); $q_cmd = preg_replace("/%id/" ,"ALL" ,$q_cmd); - if(chkacl($this->acl,"query")!=""){ + + if(!$this->acl_is_readable("query")){ print_red(sprintf(_("You do not have permission to execute the command '%s' on the mailqueue."),"query")); $mailQueueParser = new parseMailQueue("",$this->Server); }else{ @@ -375,6 +376,36 @@ class mailqueue extends plugin )); } + /* Return plugin informations for acl handling + #FIXME You can only read attributes within this report plugin */ + function plInfo() + { + return (array( + "plShortName" => _("Mailqueue"), + "plDescription" => _("Mailqueue addon"), + "plSelfModify" => FALSE, + "plDepends" => array(), + "plPriority" => 1, + "plSection" => array("addon"), + "plCategory" => array("mailqueue" => array("objectClass" => "none", "description" => _("Mail queue addon"))), + + "plProvidedAcls" => array( + "unhold_all" => _("Unhold all messages"), + "hold_all" => _("Hold all messages"), + "del_all" => _("Delete all messages"), + "requeue_all" => _("Requeue all messages"), + "unhold" => _("Unhold message"), + "hold" => _("Hold message"), + "del" => _("Delete message"), + "requeue" => _("Requeue message"), + "query" => _("Gathering queue data"), + "header" => _("Get header information") + ) + )); + } + + + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/plugins/addons/mailqueue/main.inc b/plugins/addons/mailqueue/main.inc index 401812db7..916f878d6 100644 --- a/plugins/addons/mailqueue/main.inc +++ b/plugins/addons/mailqueue/main.inc @@ -21,14 +21,14 @@ if (!$remove_lock){ /* Create mailqueue object on demand */ if (!isset($_SESSION['mailqueue']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){ + $ui = get_userinfo(); $_SESSION['mailqueue']= new mailqueue ($config); + #$_SESSION['mailqueue']->set_acl_base($ui->dn); + $_SESSION['mailqueue']->set_acl_base($config->current['BASE']); + $_SESSION['mailqueue']->set_acl_category("mailqueue"); } $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 (); -- 2.30.2