Code

Updated acl for mailqueue
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 31 Oct 2006 11:58:48 +0000 (11:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 31 Oct 2006 11:58:48 +0000 (11:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4977 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/mailqueue/class_mailqueue.inc
plugins/addons/mailqueue/main.inc

index 73aa90a76092045ec169da9df85ab24119083c86..19268178dcd337f7d3d9a17ae27f344c38e7bc33 100644 (file)
@@ -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:
 ?>
index 401812db760f6a6331cd27b194a9aa4bc5a35e35..916f878d601726e205fe17b7a23b3988d96ee91d 100644 (file)
 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 ();