Code

Added acls to mail service
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Sep 2006 09:24:55 +0000 (09:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Sep 2006 09:24:55 +0000 (09:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4776 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_goMailServer.inc
plugins/admin/systems/goMailServer.tpl

index f72af1d2b7eb3a1e485bcf93cc07e631ce12daae..7dfb9229e8494fb69c2fbbaedb5bb705f434047a 100644 (file)
@@ -189,7 +189,14 @@ class goMailServer extends plugin{
   function execute()
   { 
     $smarty   = get_smarty();
-    $delAr    = array( "TranslationDel_"=>"TranslationDel",
+
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translation){
+      $smarty->assign($name."ACL",$this->getacl($name));
+    }
+
+    $delAr    = array( 
+                    "TranslationDel_"=>"TranslationDel",
                     "SenderRestrictDel_"=>"SenderRestrictDel",
                     "RecipientRestrictDel_"=>"RecipientRestrictDel");
  
@@ -209,37 +216,37 @@ class goMailServer extends plugin{
       }
   
 
-      if(preg_match("/^TranslationUp_/",$name) && $once){
+      if(preg_match("/^TranslationUp_/",$name) && $once && ($this->acl_iw_writeablei("postfixTransportTableACL"))){
         $once = false;
         $key = preg_replace("/^TranslationUp_/","",$name);
         $key = preg_replace("/_[xy]$/","",$key);
         $this->postfixTransportTable = $this->ArrayUp($key,$this->postfixTransportTable) ;
       }
-      if(preg_match("/^TranslationDown_/",$name) && $once){
+      if(preg_match("/^TranslationDown_/",$name) && $once && ($this->acl_iw_writeable("postfixTransportTableACL"))){
         $once = false;
         $key = preg_replace("/^TranslationDown_/","",$name);
         $key = preg_replace("/_[xy]$/","",$key);
         $this->postfixTransportTable = $this->ArrayDown($key,$this->postfixTransportTable) ;
       }
-      if(preg_match("/^SenderRestrictUp_/",$name) && $once){
+      if(preg_match("/^SenderRestrictUp_/",$name) && $once && ($this->acl_iw_writeable("postfixSenderRestrictionsACL"))){
         $once = false;
         $key = preg_replace("/^SenderRestrictUp_/","",$name);
         $key = preg_replace("/_[xy]$/","",$key);
         $this->postfixSenderRestrictions = $this->ArrayUp($key,$this->postfixSenderRestrictions) ;
       }
-      if(preg_match("/^SenderRestrictDown_/",$name) && $once){
+      if(preg_match("/^SenderRestrictDown_/",$name) && $once && ($this->acl_iw_writeable("postfixSenderRestrictionsACL"))){
         $once = false;
         $key = preg_replace("/^SenderRestrictDown_/","",$name);
         $key = preg_replace("/_[xy]$/","",$key);
         $this->postfixSenderRestrictions = $this->ArrayDown($key,$this->postfixSenderRestrictions) ;
       }
-      if(preg_match("/^RecipientRestrictUp_/",$name) && $once){
+      if(preg_match("/^RecipientRestrictUp_/",$name) && $once && ($this->acl_iw_writeable("postfixRecipientRestrictionsACL"))){
         $once = false;
         $key = preg_replace("/^RecipientRestrictUp_/","",$name);
         $key = preg_replace("/_[xy]$/","",$key);
         $this->postfixRecipientRestrictions = $this->ArrayUp($key,$this->postfixRecipientRestrictions) ;
       }
-      if(preg_match("/^RecipientRestrictDown_/",$name) && $once){
+      if(preg_match("/^RecipientRestrictDown_/",$name) && $once && ($this->acl_iw_writeable("postfixRecipientRestrictionsACL"))){
         $once = false;
         $key = preg_replace("/^RecipientRestrictDown_/","",$name);
         $key = preg_replace("/_[xy]$/","",$key);
@@ -262,82 +269,88 @@ class goMailServer extends plugin{
 
 
     /* Add delete my domain entry */
-    if((isset($_POST['AddpostfixMyDestinations'])) && (!empty($_POST['NewString_postfixMyDestinations']))){
-      $str = $_POST['NewString_postfixMyDestinations'];
-      $this->postfixMyDestinations[base64_encode($str)] = $str;
-    }
+    if($this->acl_is_writeable("postfixMyDestinations")){
+      if((isset($_POST['AddpostfixMyDestinations'])) && (!empty($_POST['NewString_postfixMyDestinations']))){
+        $str = $_POST['NewString_postfixMyDestinations'];
+        $this->postfixMyDestinations[base64_encode($str)] = $str;
+      }
 
-    if((isset($_POST['DelpostfixMyDestinations'])) && isset($_POST['Select_postfixMyDestinations']) &&(count($_POST['Select_postfixMyDestinations']))){
-      foreach($_POST['Select_postfixMyDestinations'] as $str ){
-        unset($this->postfixMyDestinations[$str]);
+      if((isset($_POST['DelpostfixMyDestinations'])) && isset($_POST['Select_postfixMyDestinations']) &&(count($_POST['Select_postfixMyDestinations']))){
+        foreach($_POST['Select_postfixMyDestinations'] as $str ){
+          unset($this->postfixMyDestinations[$str]);
+        }
       }
     }
 
 
     /* Add sender restriction */
-    if(($s_action == "SenderRestrictDel") && (isset($this->postfixSenderRestrictions[$s_entry]))){
-      unset($this->postfixSenderRestrictions[$s_entry]);
-    }
+    if($this->acl_is_writeable("postfixSenderRestrictions")){
+      if(($s_action == "SenderRestrictDel") && (isset($this->postfixSenderRestrictions[$s_entry]))){
+        unset($this->postfixSenderRestrictions[$s_entry]);
+      }
 
-    if(isset($_POST['AddpostfixSenderRestrictions'])){
-      $src      = $_POST['Source_postfixSenderRestrictions'];
-      $dst      = $_POST['Destination_postfixSenderRestrictions'];
-      $Filter   = $_POST['SenderRestrictionFilter'];
-      $tmp['src']     = $src;
-      $tmp['dst']     = $dst;
-      $tmp['filter']  = $Filter;
-      $this->postfixSenderRestrictions[] = $tmp;
+      if(isset($_POST['AddpostfixSenderRestrictions'])){
+        $src      = $_POST['Source_postfixSenderRestrictions'];
+        $dst      = $_POST['Destination_postfixSenderRestrictions'];
+        $Filter   = $_POST['SenderRestrictionFilter'];
+        $tmp['src']     = $src;
+        $tmp['dst']     = $dst;
+        $tmp['filter']  = $Filter;
+        $this->postfixSenderRestrictions[] = $tmp;
+      }
     }
 
 
     /* Add sender restriction */
-    if(($s_action == "RecipientRestrictDel") && (isset($this->postfixRecipientRestrictions[$s_entry]))){
-      unset($this->postfixRecipientRestrictions[$s_entry]);
-    }
+    if($this->acl_is_writeable("postfixRecipientRestrictions")){
+      if(($s_action == "RecipientRestrictDel") && (isset($this->postfixRecipientRestrictions[$s_entry]))){
+        unset($this->postfixRecipientRestrictions[$s_entry]);
+      }
 
-    if(isset($_POST['AddpostfixRecipientRestrictions'])){
-      $src      = $_POST['Source_postfixRecipientRestrictions'];
-      $dst      = $_POST['Destination_postfixRecipientRestrictions'];
-      $Filter   = $_POST['RecipientRestrictionFilter'];
-      $tmp['src']     = $src;
-      $tmp['dst']     = $dst;
-      $tmp['filter']  = $Filter;
-      $this->postfixRecipientRestrictions[] = $tmp;
+      if(isset($_POST['AddpostfixRecipientRestrictions'])){
+        $src      = $_POST['Source_postfixRecipientRestrictions'];
+        $dst      = $_POST['Destination_postfixRecipientRestrictions'];
+        $Filter   = $_POST['RecipientRestrictionFilter'];
+        $tmp['src']     = $src;
+        $tmp['dst']     = $dst;
+        $tmp['filter']  = $Filter;
+        $this->postfixRecipientRestrictions[] = $tmp;
+      }
     }
 
-
     /* Handle transports */
-    if(($s_action == "TranslationDel") && (isset($this->postfixTransportTable[$s_entry]))){
-      unset($this->postfixTransportTable[$s_entry]);
-    }
-    
-    if(isset($_POST['AddpostfixTransportTable'])){
-      $src = trim($_POST['Source_postfixTransportTable']);  
-      $dst = trim($_POST['Destination_postfixTransportTable']);    
-      $prt = trim($_POST['TransportProtocol']);
-
-      if((!empty($src)) && (!empty($dst))){
-        if(preg_match("/:/",$dst)){
-          $tmp = split("\:",$dst);
-          $port = trim($tmp[1]);
-          $ip   = trim($tmp[0]);
-    
-          if((is_ip($ip)) && (is_numeric($port))){
-            $dst = "[".$ip."]:".$port;
+    if($this->acl_is_writeable("postfixTransportTable")){
+      if(($s_action == "TranslationDel") && (isset($this->postfixTransportTable[$s_entry]))){
+        unset($this->postfixTransportTable[$s_entry]);
+      }
+
+      if(isset($_POST['AddpostfixTransportTable'])){
+        $src = trim($_POST['Source_postfixTransportTable']);  
+        $dst = trim($_POST['Destination_postfixTransportTable']);    
+        $prt = trim($_POST['TransportProtocol']);
+
+        if((!empty($src)) && (!empty($dst))){
+          if(preg_match("/:/",$dst)){
+            $tmp = split("\:",$dst);
+            $port = trim($tmp[1]);
+            $ip   = trim($tmp[0]);
+
+            if((is_ip($ip)) && (is_numeric($port))){
+              $dst = "[".$ip."]:".$port;
+            }
           }
-        }
-        if(is_ip($dst)){
-          $dst = "[".$dst."]";
-        }
-        $tmp2 ['src'] = $src;
-        $tmp2 ['dst'] = $dst;
-        $tmp2 ['prt'] = $prt;
+          if(is_ip($dst)){
+            $dst = "[".$dst."]";
+          }
+          $tmp2 ['src'] = $src;
+          $tmp2 ['dst'] = $dst;
+          $tmp2 ['prt'] = $prt;
 
-        $this->postfixTransportTable[] = $tmp2;  
-      } 
+          $this->postfixTransportTable[] = $tmp2;  
+        } 
+      }
     }
 
-
     /* Set attributes */
     foreach($this->attributes as $attr){
       $smarty->assign($attr,$this->$attr);
@@ -350,18 +363,20 @@ class goMailServer extends plugin{
     foreach($this->postfixTransportTable as $key => $entry){
       $img = "";
 
-      if($key != 0){
+      if($key != 0 && $this->acl_is_writeable("postfixTransportTable")){
         $img.= "<input type='image' src='images/sort_up.png' name='TranslationUp_".$key."' class='center'>&nbsp;";      
       }else{
         $img.= "<img src='images/empty.png' style='width:10px;'>";
       }
-      if(($key+1) < count($this->postfixTransportTable)){
+      if(($key+1) < count($this->postfixTransportTable) && $this->acl_is_writeable("postfixTransportTable")){
         $img.= "<input type='image' src='images/sort_down.png' name='TranslationDown_".$key."' class='center'>&nbsp;";      
       }else{
         $img.= "<img src='images/empty.png' style='width:10px;'>";
       }
 
-      $img.= "<input type='image' src='images/edittrash.png' name='TranslationDel_".$key."' class='center'>&nbsp;";      
+      if($this->acl_is_writeable("postfixTransportTable")){
+        $img.= "<input type='image' src='images/edittrash.png' name='TranslationDel_".$key."' class='center'>&nbsp;";      
+      }
       $field1 = array("string"=> $entry['src']);
       $field2 = array("string"=> $entry['dst']);
       $field3 = array("string"=> $entry['prt'],"attach"=>"style='width:120px;'");
@@ -377,18 +392,20 @@ class goMailServer extends plugin{
     foreach($this->postfixSenderRestrictions as $key => $entry){
       $img ="";
 
-      if($key != 0){
+      if($key != 0 && $this->acl_is_writeable("postfixSenderRestrictions")){
         $img.= "<input type='image' src='images/sort_up.png' name='SenderRestrictUp_".$key."' class='center'>&nbsp;";      
       }else{
         $img.= "<img src='images/empty.png' style='width:10px;'>";
       }
-      if(($key+1) < count($this->postfixSenderRestrictions)){
+      if(($key+1) < count($this->postfixSenderRestrictions) && $this->acl_is_writeable("postfixSenderRestrictions")){
         $img.= "<input type='image' src='images/sort_down.png' name='SenderRestrictDown_".$key."' class='center'>&nbsp;";      
       }else{
         $img.= "<img src='images/empty.png' style='width:10px;'>";
       }
 
-      $img.= "<input type='image' src='images/edittrash.png' name='SenderRestrictDel_".$key."' class='center'>&nbsp;";     
+      if($this->acl_is_writeable("postfixSenderRestrictions")){
+        $img.= "<input type='image' src='images/edittrash.png' name='SenderRestrictDel_".$key."' class='center'>&nbsp;";     
+      }
  
       $field1 = array("string"=> $entry['src']);
       $field2 = array("string"=> $entry['dst']);
@@ -405,17 +422,20 @@ class goMailServer extends plugin{
 
     foreach($this->postfixRecipientRestrictions as $key => $entry){
       $img = "";
-      if($key != 0){
+      if($key != 0 && $this->acl_is_writeable("postfixRecipientRestrictions")){
         $img.= "<input type='image' src='images/sort_up.png' name='RecipientRestrictUp_".$key."' class='center'>&nbsp;";      
       }else{
         $img.= "<img src='images/empty.png' style='width:10px;'>";
       }
-      if(($key+1) < count($this->postfixRecipientRestrictions)){
+      if(($key+1) < count($this->postfixRecipientRestrictions) && $this->acl_is_writeable("postfixRecipientRestrictions")){
         $img.= "<input type='image' src='images/sort_down.png' name='RecipientRestrictDown_".$key."' class='center'>&nbsp;";      
       }else{
         $img.= "<img src='images/empty.png' style='width:10px;'>";
       }
-      $img.= "<input type='image' src='images/edittrash.png' name='RecipientRestrictDel_".$key."' class='center'>&nbsp;";      
+
+      if($this->acl_is_writeable("postfixRecipientRestrictions")){
+        $img.= "<input type='image' src='images/edittrash.png' name='RecipientRestrictDel_".$key."' class='center'>&nbsp;";      
+      }
       $field1 = array("string"=> $entry['src']);
       $field2 = array("string"=> $entry['dst']);
       $field3 = array("string"=> $entry['filter'],"attach"=>"style='width:100px;'");
@@ -785,6 +805,7 @@ class goMailServer extends plugin{
           "plCategory"    => array("server"),
 
           "plProvidedAcls"=> array(
+            "postfixMyhostname"           => _("Visible full qualified hostname"),
             "description"                 => _("Description"), 
             "postfixHeaderSizeLimit"      => _("Header size limit"), 
             "postfixMailboxSizeLimit"     => _("Max mailbox size"), 
index a075cde94802492aa6a6e9a40033eb7197d223e9..4d3f87080af440b37fd6dff694c77ef3704f8890 100644 (file)
@@ -7,39 +7,48 @@
                                        <td>{t}Visible full qualified hostname{/t}
                                        </td>
                                        <td>
+{render acl=$postfixMyhostnameACL}
                                                <input type="text" name='postfixMyhostname' value='{$postfixMyhostname}' title='{t}The full qualified host name.{/t}'>
+{/render}
                                        </td>
                                </tr>
                                <tr>
                                        <td>{t}Max mail header size{/t}
                                        </td>
                                        <td>
+{render acl=$postfixMyhostnameACL}
                                                <input type="text" name='postfixHeaderSizeLimit' value='{$postfixHeaderSizeLimit}' 
                                                                        title='{t}This value specifies the maximal header size.{/t}'>&nbsp;{t}KB{/t}
+{/render}
                                        </td>
                                </tr>
                                <tr>
                                        <td>{t}Max mailbox size{/t}
                                        </td>
                                        <td>
+{render acl=$postfixMailboxSizeLimitACL}
                                                <input type="text" name='postfixMailboxSizeLimit' value='{$postfixMailboxSizeLimit}' 
                                                                        title='{t}Defines the maximal size of mail box.{/t}'>&nbsp;{t}KB{/t}
-                                       </td>
+{/render}                                      </td>
                                </tr>
                                <tr>
                                        <td>{t}Max message size{/t}
                                        </td>
                                        <td>
+{render acl=$postfixMessageSizeLimitACL}
                                                <input type="text" name='postfixMessageSizeLimit' value='{$postfixMessageSizeLimit}' 
                                                                        title='{t}Specify the maximal size of a message.{/t}'>&nbsp;{t}KB{/t}
+{/render}
                                        </td>
                                </tr>
                                <tr>
                                        <td>{t}Relay host{/t}
                                        </td>
                                        <td>
+{render acl=$postfixRelayhostACL}
                                                <input type="text" name='postfixRelayhost' value='{$postfixRelayhost}' 
                                                                        title='{t}Relay messages to following host:{/t}'>
+{/render}
                                        </td>
                                </tr>
                        </table>
                                <tr>
                                        <td>
                                                {t}Local networks{/t}<br>
+{render acl=$postfixMyNetworksACL}
                                                <select name='Select_postfixMyNetworks[]' multiple size=6 style='width:100%;' title='{t}Postfix networks{/t}'>
                                                        {html_options options=$postfixMyNetworks}
                                                </select>
+{/render}
+{render acl=$postfixMyNetworksACL}
                                                <input type="text" name="NewString_postfixMyNetworks" value="">
+{/render}
+{render acl=$postfixMyNetworksACL}
                                                <input type="submit" name="AddpostfixMyNetworks" value="{t}Add{/t}">
+{/render}
+{render acl=$postfixMyNetworksACL}
                                                <input type="submit" name="DelpostfixMyNetworks" value="{t}Remove{/t}">
+{/render}
                                        </td>
                                </tr>
                        </table>
                 <tr>
                     <td>
                         {t}Domains to accept mail for{/t}<br>
+{render acl=$postfixMyDestinationsACL}
                         <select name='Select_postfixMyDestinations[]' multiple size=6 style='width:100%;' title='{t}Postfix is responsible for the following domains:{/t}'>
+{/render}
                             {html_options options=$postfixMyDestinations}
                         </select>
+{render acl=$postfixMyDestinationsACL}
                         <input type="text" name="NewString_postfixMyDestinations" value="">
+{/render}
+{render acl=$postfixMyDestinationsACL}
                         <input type="submit" name="AddpostfixMyDestinations" value="{t}Add{/t}">
+{/render}
+{render acl=$postfixMyDestinationsACL}
                         <input type="submit" name="DelpostfixMyDestinations" value="{t}Remove{/t}">
+{/render}
                     </td>
                 </tr>
             </table>
                 <tr>
                     <td>
                         {t}Transports{/t}<br>
+{render acl=$postfixTransportTableACL}
                                                {$Div_postfixTransportTable}
+{/render}
+
+{render acl=$postfixTransportTableACL}
                         <input type="text" name="Source_postfixTransportTable" value="">
+{/render}
+{render acl=$postfixTransportTableACL}
                         <select name='TransportProtocol' title='{t}Select a transport protocol.{/t}'>
                             {html_options options=$TransportProtocols}
                         </select>
+{/render}
+{render acl=$postfixTransportTableACL}
                         <input type="text" name="Destination_postfixTransportTable" value="">
+{/render}
+{render acl=$postfixTransportTableACL}
                         <input type="submit" name="AddpostfixTransportTable" value="{t}Add{/t}">
+{/render}
                     </td>
                 </tr>
             </table>
                 <tr>
                     <td>
                         {t}Restrictions for sender{/t}<br>
+{render acl=$postfixSenderRestrictionsACL}
                                                {$Div_postfixSenderRestrictions}
+{/render}
+{render acl=$postfixSenderRestrictionsACL}
                         <input type="text" name="Source_postfixSenderRestrictions" value="">
+{/render}
+{render acl=$postfixSenderRestrictionsACL}
                         <select name='SenderRestrictionFilter' title='{t}Restriction filter{/t}'>
                             {html_options options=$RestrictionFilters}
                         </select>
+{/render}
+{render acl=$postfixSenderRestrictionsACL}
                         <input type="text" name="Destination_postfixSenderRestrictions" value="">
+{/render}
+{render acl=$postfixSenderRestrictionsACL}
                         <input type="submit" name="AddpostfixSenderRestrictions" value="{t}Add{/t}">
+{/render}
                     </td>
                 </tr>
             </table>
                 <tr>
                     <td>
                         {t}Restrictions for recipient{/t}<br>
+{render acl=$postfixRecipientRestrictionsACL}
                                                {$Div_postfixRecipientRestrictions}
+{/render}
+{render acl=$postfixRecipientRestrictionsACL}
                         <input type="text" name="Source_postfixRecipientRestrictions" value="">
+{/render}
+{render acl=$postfixRecipientRestrictionsACL}
                         <select name='RecipientRestrictionFilter' title='{t}Restriction filter{/t}'>
                             {html_options options=$RestrictionFilters}
                         </select>
+{/render}
+{render acl=$postfixRecipientRestrictionsACL}
                         <input type="text" name="Destination_postfixRecipientRestrictions" value="">
+{/render}
+{render acl=$postfixRecipientRestrictionsACL}
                         <input type="submit" name="AddpostfixRecipientRestrictions" value="{t}Add{/t}">
-                                               
+{/render}
                     </td>
                 </tr>
             </table>