From bbd2945ac015b116c069d57ca9df82c76fb5a88c Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 22 Jul 2008 10:58:56 +0000 Subject: [PATCH] Updated dns ACls. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11745 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/services/dns/class_servDNS.inc | 1 + .../services/dns/class_servDNSeditZone.inc | 6 ++- .../dns/class_servDNSeditZoneEntries.inc | 53 +++++++++++++------ .../services/dns/servDNSeditZoneEntries.tpl | 5 ++ .../systems/services/dns/servdnseditzone.tpl | 2 + 5 files changed, 48 insertions(+), 19 deletions(-) diff --git a/gosa-plugins/dns/admin/systems/services/dns/class_servDNS.inc b/gosa-plugins/dns/admin/systems/services/dns/class_servDNS.inc index 93d5db4d0..a96de276d 100644 --- a/gosa-plugins/dns/admin/systems/services/dns/class_servDNS.inc +++ b/gosa-plugins/dns/admin/systems/services/dns/class_servDNS.inc @@ -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"), diff --git a/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZone.inc b/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZone.inc index 4eeff2719..2a57dd2f5 100644 --- a/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZone.inc +++ b/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZone.inc @@ -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; diff --git a/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZoneEntries.inc b/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZoneEntries.inc index 27a9aa932..78b9be741 100644 --- a/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZoneEntries.inc +++ b/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZoneEntries.inc @@ -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 .="\n"; + $str .="\n"; } /* Create rest. Selectbox, icons ... @@ -445,12 +455,17 @@ class servDNSeditZoneEntries extends plugin ".$this->createRecordTypeSelection($record['type'],$name)." - - - - - - "; + + "; + + if(preg_match("/w/",$this->acl)){ + $str .= " + + + "; + } $str.= " @@ -465,15 +480,19 @@ class servDNSeditZoneEntries extends plugin */ function createRecordTypeSelection($id,$refID){ - $str = "\n"; + foreach($this->RecordTypes as $type => $atr) { + if($id == $type){ + $str .="\n"; + }else{ + $str .="\n"; + } } + $str.= "\n"; + }else{ + $str = " ".strtoupper(preg_replace("/record/i","",$id)); } - $str.= "\n"; return($str); } diff --git a/gosa-plugins/dns/admin/systems/services/dns/servDNSeditZoneEntries.tpl b/gosa-plugins/dns/admin/systems/services/dns/servDNSeditZoneEntries.tpl index e1b2b53eb..3e972844a 100644 --- a/gosa-plugins/dns/admin/systems/services/dns/servDNSeditZoneEntries.tpl +++ b/gosa-plugins/dns/admin/systems/services/dns/servDNSeditZoneEntries.tpl @@ -8,13 +8,18 @@
{$table}
+ + {render acl=$acl} + {/render} {/if}

 

+ {render acl=$acl} + {/render}

diff --git a/gosa-plugins/dns/admin/systems/services/dns/servdnseditzone.tpl b/gosa-plugins/dns/admin/systems/services/dns/servdnseditzone.tpl index fb947b41f..32a2d8fdf 100644 --- a/gosa-plugins/dns/admin/systems/services/dns/servdnseditzone.tpl +++ b/gosa-plugins/dns/admin/systems/services/dns/servdnseditzone.tpl @@ -52,7 +52,9 @@ {/if} +{render acl=$zoneEditorACL mode=read_active} +{/render} -- 2.30.2