Code

Added acls for sieve trunk
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Mar 2007 08:21:47 +0000 (08:21 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Mar 2007 08:21:47 +0000 (08:21 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5880 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_sieveManagement.inc
plugins/personal/mail/class_mailAccount.inc
plugins/personal/mail/generic.tpl

index d5701e3bb87e96683df4ecd2b3bd8aec0621c8ef..da9a10978ede1fb058ddd512db582640f9d5b743 100644 (file)
@@ -273,16 +273,15 @@ class sieveManagement extends plugin
       }
 
       /* remove script requested */
-      if(preg_match("/^delscript_/",$name) && $once && !$this->current_handler){
+      if($this->parent->acl_is_writeable("sieveManagement") && preg_match("/^delscript_/",$name) && $once && !$this->current_handler){
         $script = preg_replace("/^delscript_/","",$name);
         $script = preg_replace("/_(x|y)/","",$script);
         $once = FALSE;
         $this->script_to_delete = $script;  
       }
 
       /* Activate script */
-      if(preg_match("/^active_script_/",$name) && $once && !$this->current_handler){
+      if($this->parent->acl_is_writeable("sieveManagement") && preg_match("/^active_script_/",$name) && $once && !$this->current_handler){
         $script = preg_replace("/^active_script_/","",$name);
         $script = preg_replace("/_(x|y)/","",$script);
         $once = FALSE;
@@ -327,7 +326,7 @@ class sieveManagement extends plugin
     }
 
     /* Remove confirmed */
-    if(isset($_POST['delete_script_confirm'])){
+    if($this->parent->acl_is_writeable("sieveManagement") && isset($_POST['delete_script_confirm'])){
 
       $script = $this->scripts[$this->script_to_delete];
 
@@ -376,7 +375,7 @@ class sieveManagement extends plugin
     }
 
     /* Save currently edited sieve script. */
-    if(isset($_POST['save_sieve_changes'])){
+    if($this->parent->acl_is_writeable("sieveManagement") && isset($_POST['save_sieve_changes'])){
       $chk = $this->current_handler->check();
       if(!count($chk)){
 
@@ -642,15 +641,19 @@ class sieveManagement extends plugin
                         "attach" => "style='width:30px;'");
       }
 
-      if($active || $script['IS_NEW']){
-        $field6 = array("string" => "<img src='images/empty.png' alt=' '>".
-                                    "<input type='image' name='editscript_".$key."' src='images/edit.png'>".
-                                    "<input type='image' name='delscript_".$key."' src='images/edittrash.png'>");
+      if($this->parent->acl_is_writeable("sieveManagement")){
+        $del = "<input type='image' name='delscript_".$key."' src='images/edittrash.png'>";
       }else{
-        $field6 = array("string" => "<input type='image' name='active_script_".$key."' src='images/true.png'>".
-                                    "<input type='image' name='editscript_".$key."' src='images/edit.png'>".
-                                    "<input type='image' name='delscript_".$key."' src='images/edittrash.png'>");
+        $del = "<img src='images/empty' alt=' '>";
       }
+
+      if($active || $script['IS_NEW'] || !$this->parent->acl_is_writeable("sieveManagement")){
+        $activate = "<img src='images/empty' alt=' '>";
+      }else{
+        $activate = "<input type='image' name='active_script_".$key."' src='images/true.png'>";
+      }
+
+      $field6 = array("string" => $activate."<input type='image' name='editscript_".$key."' src='images/edit.png'>".$del);
       $List ->AddEntry(array($field1,$field2,$field3,$field4,$field5,$field6)); 
     }
   
index da82a9423ee78652715d5221a47b99bd43a44a5e..ff796593ea991926123fa94c8f80c61f3ff0a3e6 100644 (file)
@@ -238,7 +238,9 @@ class mailAccount extends plugin
     /* 
      * Sieve Management 
      */
-    if(isset($_POST['sieveManagement']) && preg_match("/C/",$this->gosaMailDeliveryMode)) {
+    if(isset($_POST['sieveManagement']) 
+        && preg_match("/C/",$this->gosaMailDeliveryMode)
+        && $this->acl_is_writeable("sieveManagement")) {
       $this->dialog = new sieveManagement($this->config,$this->dn,$this);
     }
    
@@ -549,7 +551,10 @@ class mailAccount extends plugin
       $smarty->assign("mailACL", preg_replace("/w/","",$this->getacl("mail",$SkipWrite)));
     }
 
-    if (preg_match('/V/', $this->gosaMailDeliveryMode)){
+    /* Disable/Enable range select, but do not disable them twice 
+     *  if they are already diabled by "use own sieve script"
+     */
+    if (preg_match('/V/', $this->gosaMailDeliveryMode) || preg_match("/C/",$this->gosaMailDeliveryMode)){
       $smarty->assign('rangeEnabled', "");
     } else {
       $smarty->assign('rangeEnabled', "disabled");
@@ -1127,6 +1132,8 @@ class mailAccount extends plugin
             "gosaSpamSortLevel"         =>  _("Spam level"),
             "gosaSpamMailbox"           =>  _("Spam mail box"),
 
+            "sieveManagement"           =>  _("Sieve manamgent"),
+
             "gosaMailDeliveryModeR"     =>  _("Reject due to mailsize"),    // This is flag of gosaMailDeliveryMode
             "gosaMailMaxSize"           =>  _("Mail max size"),
 
index 51e424fa228246ecad82c2c34f62c91af3bb00bd..12bc8b1755cbb7eb36b731c42958cab393521d9f 100644 (file)
   </td>
  </tr>
  <tr>
-  <td> 
+  <td>
+{render acl=$sieveManagementACL}       
    <input {if $own_script == ""} disabled {/if} id='sieveManagement' type='submit' name='sieveManagement' value='{t}Sieve Management{/t}'>
+{/render}
   </td>
  </tr>
 </table>