Code

Updated dns ACls.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Jul 2008 10:58:56 +0000 (10:58 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Jul 2008 10:58:56 +0000 (10:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11745 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/dns/admin/systems/services/dns/class_servDNS.inc
gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZone.inc
gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZoneEntries.inc
gosa-plugins/dns/admin/systems/services/dns/servDNSeditZoneEntries.tpl
gosa-plugins/dns/admin/systems/services/dns/servdnseditzone.tpl

index 93d5db4d0c2361cc6c72362239962635505b91f3..a96de276d0298a37c0ca4d6b0c4bfd1aea6d5dcb 100644 (file)
@@ -585,6 +585,7 @@ class servdns extends goService
             "zoneName"      =>_("Zone name"),
             "ReverseZone"   =>_("Reverse zone"),
             "NetworkClass"  =>_("Network class"),
+            "zoneEditor"    =>_("Zone entry editor"),
             "sOAprimary"    =>_("Primary dns server"),
             "sOAmail"       =>_("Mail address"),
             "sOAserial"     =>_("Serial"),
index 4eeff271971de65f1d85a5d49986f98b0453bc4b..2a57dd2f50086e205f158e5016e670f2c88259bc 100644 (file)
@@ -228,9 +228,11 @@ class servdnseditZone extends plugin
       $smarty->assign("AllowZoneEdit" , false);
     }else{
       $smarty->assign("AllowZoneEdit" , true);
-      if(isset($_POST['EditZoneEntries'])){
+
+      if(isset($_POST['EditZoneEntries']) && $this->parent->acl_is_readable("zoneEditor")){
         if($this->zoneEditor == NULL){
-          $this->zoneEditor= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject);
+          $this->zoneEditor= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject); 
+          $this->zoneEditor->acl = $this->parent->getacl("zoneEditor");
           $this->zoneEditor->parent = $this;
         }
         $this->dialog = $this->zoneEditor;
index 27a9aa932b2c2c8aafc6c65a775287e5b6643feb..78b9be741e3819c429ec63295341b81302612168 100644 (file)
@@ -13,7 +13,7 @@ class servDNSeditZoneEntries extends plugin
   var $reverseName        = "";   // ReverseZone of the currently edited Zone
 
   var $RecordTypes        = array();  // Possible record type.
-
+  var $acl                = "";
   var $disableDialog      = false; // Dialog will be disabled, if this zone is new 
 
 
@@ -72,6 +72,7 @@ class servDNSeditZoneEntries extends plugin
       $table .= $this->generateRecordConfigurationRow($key);
     }
 
+    $smarty->assign("acl",$this->acl);
     $smarty->assign("disableDialog",$this->disableDialog);
     $smarty->assign("table",$table);;
     $display.= $smarty->fetch(get_template_path('servDNSeditZoneEntries.tpl', TRUE, dirname(__FILE__)));
@@ -85,6 +86,8 @@ class servDNSeditZoneEntries extends plugin
      */
     $once = true;
     $ptr_updates = array();
+    if(!preg_match("/w/",$this->acl)) return;
+
     foreach($_POST as $name => $value){
 
       /* Add a new Record in given object  
@@ -232,7 +235,9 @@ class servDNSeditZoneEntries extends plugin
   {
     /* Call common method to give check the hook */
     $message= plugin::check();
-    
+   
+    if(!preg_match("/w/",$this->acl)) return($message);
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
 
@@ -317,7 +322,7 @@ class servDNSeditZoneEntries extends plugin
 
   function save()
   {
-    if($this->disableDialog) return;
+    if($this->disableDialog || !preg_match("/w/",$this->acl)) return;
 
     $todo = array(); 
 
@@ -404,6 +409,11 @@ class servDNSeditZoneEntries extends plugin
     $obj        = $this->Devices[$objKey];
     $objectName = $objKey;
 
+    $dis = "";
+    if(!preg_match("/w/",$this->acl)){
+      $dis = " disabled ";
+    }
+
     /* Abort if emtpy
      */
     if(count($obj['RECORDS']) == 0) return "";
@@ -434,7 +444,7 @@ class servDNSeditZoneEntries extends plugin
        */
       if($hostNameOnce){
         $hostNameOnce = false;  
-        $str .="<input type='text' name='RenameHost_".$name."' value='".$objectName."'>\n";
+        $str .="<input $dis type='text' name='RenameHost_".$name."' value='".$objectName."'>\n";
       }
 
       /* Create rest. Selectbox, icons ...
@@ -445,12 +455,17 @@ class servDNSeditZoneEntries extends plugin
           ".$this->createRecordTypeSelection($record['type'],$name)."
         </td>
         <td>
-          <input type='text'  value='".$record['value']."' name='ValueSelection_".$name."' style='width:250px;'>
-        </td>
-        <td style='width:75px;text-align:right;'>
-          <input type='image' name='AddRecord_".$name."'   src='images/lists/new.png' alt='"._("Add")."' title='"._("Add")."'>
-          <input type='image' name='RemoveRecord_".$name."' src='images/lists/trash.png'      alt='"._("Remove")."' title='"._("Remove")."'>
-        ";
+          <input type='text' $dis value='".$record['value']."' name='ValueSelection_".$name."' style='width:250px;'>
+        </td>";
+
+      if(preg_match("/w/",$this->acl)){
+        $str .= "<td style='width:75px;text-align:right;'>
+          <input type='image' name='AddRecord_".$name."'   
+          src='images/lists/new.png' alt='"._("Add")."' title='"._("Add")."'>
+          <input type='image' name='RemoveRecord_".$name."' 
+          src='images/lists/trash.png'      alt='"._("Remove")."' title='"._("Remove")."'>
+          ";
+      }
 
       $str.=
         "</td>
@@ -465,15 +480,19 @@ class servDNSeditZoneEntries extends plugin
    */
   function createRecordTypeSelection($id,$refID){
 
-    $str = "\n<select name='RecordTypeSelection_".$refID."'>";
-    foreach($this->RecordTypes as $type => $atr) {
-      if($id == $type){
-        $str .="\n<option value='".$type."' selected >".strtoupper(preg_replace("/record/i","",$type))."</option>";
-      }else{
-        $str .="\n<option value='".$type."'>".strtoupper(preg_replace("/record/i","",$type))."</option>";
+    if(preg_match("/w/",$this->acl)){
+      $str = "\n<select name='RecordTypeSelection_".$refID."'>";
+      foreach($this->RecordTypes as $type => $atr) {
+        if($id == $type){
+          $str .="\n<option value='".$type."' selected >".strtoupper(preg_replace("/record/i","",$type))."</option>";
+        }else{
+          $str .="\n<option value='".$type."'>".strtoupper(preg_replace("/record/i","",$type))."</option>";
+        }
       }
+      $str.= "\n</select>";
+    }else{
+      $str = "&nbsp;".strtoupper(preg_replace("/record/i","",$id));
     }
-    $str.= "\n</select>";
     return($str);
   }
 
index e1b2b53ebfda81146193915bf96b1dfe6b5f739b..3e972844abe2b870d396725f681a60ff0434b7f4 100644 (file)
@@ -8,13 +8,18 @@
        <br>
        {$table}
        <br>
+
+       {render acl=$acl}
        <input type='submit' name='UserRecord' value='{t}New entry{/t}' title='{t}Create a new DNS zone entry{/t}'>
+       {/render}
 {/if}
 
 <p class="seperator">&nbsp;</p>
 <div style="text-algin:right;" align="right">
     <p>
+       {render acl=$acl}
         <input type="submit" name="SaveZoneEntryChanges" value="{msgPool type=saveButton}">
+       {/render}
         <input type="submit" name="CancelZoneEntryChanges" value="{msgPool type=cancelButton}">
     </p>
 </div>
index fb947b41fc5f0c416bd62d2d0dd60943a5a53ef4..32a2d8fdf9f695314f3cbffc869098a27e1f9e1a 100644 (file)
@@ -52,7 +52,9 @@
                                                {/if}
                                        </td>
                                        <td>
+{render acl=$zoneEditorACL mode=read_active}
                                                <input type="submit" name="EditZoneEntries" value="{t}Edit{/t}" {if $AllowZoneEdit == false} disabled {/if}> 
+{/render}
                                        </td>
                                </tr>
                        </table>