Code

Prepared dhcp plugins for ACLs.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Jul 2008 12:53:25 +0000 (12:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Jul 2008 12:53:25 +0000 (12:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11749 594d385d-05f5-0310-b6e9-bd551577e9d8

18 files changed:
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpAdvanced.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpGroup.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpHost.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpNetwork.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPlugin.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPool.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpService.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSubnet.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/class_servDHCP.inc
gosa-plugins/dhcp/admin/systems/services/dhcp/dhcp_advanced.tpl
gosa-plugins/dhcp/admin/systems/services/dhcp/dhcp_group.tpl
gosa-plugins/dhcp/admin/systems/services/dhcp/dhcp_host.tpl
gosa-plugins/dhcp/admin/systems/services/dhcp/dhcp_network.tpl
gosa-plugins/dhcp/admin/systems/services/dhcp/dhcp_pool.tpl
gosa-plugins/dhcp/admin/systems/services/dhcp/dhcp_service.tpl
gosa-plugins/dhcp/admin/systems/services/dhcp/dhcp_sharedNetwork.tpl
gosa-plugins/dhcp/admin/systems/services/dhcp/dhcp_subnet.tpl

index 3e2be402e59b267d1b835b84ddd2e9b9e703689a..9f9df65fc2f56d3c2ed2506b0f901428631ab818 100644 (file)
@@ -30,6 +30,7 @@ class dhcpAdvanced extends plugin
   /* attribute list for save action */
   var $attributes= array();
   var $objectclasses= array();
+  var $parent;
 
   function dhcpAdvanced()
   {
@@ -71,6 +72,9 @@ class dhcpAdvanced extends plugin
 
     $smarty= get_smarty();
 
+       /* Assign ACLs */
+       $smarty->assign("acl",$this->parent->getacl(""));
+
     /* Assign arrays */
     $statements= array();
     foreach ($this->statements as $key => $val){
index 8e92b5ce00b72a18f36c5b0cd91edf242a1a7b1c..08d728efb7e4bd9fd694e0fe0b859357b63c5c29 100644 (file)
@@ -23,10 +23,10 @@ class dhcpGroup extends dhcpPlugin
   /* attribute list for save action */
   var $objectclasses= array('top', 'dhcpGroup', 'dhcpOptions');
 
-  function dhcpGroup(&$attrs)
+  function dhcpGroup($parent,&$attrs)
   {
     /* Load statements / options */
-    dhcpPlugin::dhcpPlugin($attrs);
+    dhcpPlugin::dhcpPlugin($parent,$attrs);
   }
 
   function execute()
@@ -34,6 +34,9 @@ class dhcpGroup extends dhcpPlugin
     $smarty= get_smarty();
     $smarty->assign("cn", $this->cn);
 
+       /* Assign ACLs */
+       $smarty->assign("acl",$this->parent->getacl(""));
+
     /* Show main page */
     $display= $smarty->fetch (get_template_path('dhcp_group.tpl', TRUE, dirname(__FILE__))).$this->network->execute();
 
index 87f4f247abb362aa0118bd658747defef2587426..89b0c1d806e8cb5ba96fef558020e161a7e4e7b4 100644 (file)
@@ -49,6 +49,9 @@ class dhcpHost extends dhcpPlugin
     $smarty->assign("dhcpHWAddress", preg_replace('/^[^ ]+ /', '', $this->dhcpHWAddress));
     $smarty->assign("realGosaHost",$this->realGosaHost);
 
+    /* Assign ACLs */
+    $smarty->assign("acl",$this->parent->getacl(""));
+
     /* Create fixed address */
     if (isset($this->statements['fixed-address'])){
       $smarty->assign("fixedaddr", $this->statements['fixed-address']);
index 1b945354238c060d073dc39fd6155b10ad47794a..6054eb6965782632a35aededa43d56506f936e63 100644 (file)
@@ -70,6 +70,9 @@ class dhcpNetwork extends plugin
     /* Show main page */
     $smarty= get_smarty();
 
+    /* Assign ACLs */
+    $smarty->assign("acl",$this->parent->getacl(""));
+
     /*
      * Assemble options
      */
index 615981ce1cf75e182c4f5367cf7fbdd4a82a6170..ac8d0f86a81496ff030cc1191ce32d5ccc8ca6dd 100644 (file)
@@ -34,8 +34,10 @@ class dhcpPlugin extends plugin
   var $attributes= array();
   var $objectclasses= array();
 
-  function dhcpPlugin($attrs)
+  function dhcpPlugin(&$parent,$attrs)
   {
+       $this->parent = $parent;
+
     /* Load statements / options */
     if (is_array($attrs)){
       $this->dn= $attrs['dn'];
@@ -82,6 +84,9 @@ class dhcpPlugin extends plugin
     $this->advanced->options= $this->options;
     $this->advanced->statements= $this->statements;
 
+       $this->network->parent = $parent;
+       $this->advanced->parent = $parent;
+
     /* Save CN for later reference */
     $this->orig_cn= $this->cn;
   }
index 0de8a868272c9e7bcbfac83b772cdf2db17286f9..e2cff119b502d6e043c2ce3af8234ac843597215 100644 (file)
@@ -49,6 +49,9 @@ class dhcpPool extends dhcpPlugin
     $smarty->assign("range_start", $this->range_start);
     $smarty->assign("range_stop", $this->range_stop);
 
+    /* Assign ACLs */
+    $smarty->assign("acl",$this->parent->getacl(""));
+
     /* Show main page */
     $display= $smarty->fetch(get_template_path('dhcp_pool.tpl', TRUE, dirname(__FILE__))).$this->network->execute();
 
index 5856976d3590e539b885f5ad9b10504de54cc0f6..59c56588406aff5e7e34b3558deaec7a2153586e 100644 (file)
@@ -58,6 +58,9 @@ class dhcpService extends dhcpPlugin
     /* Show main page */
     $smarty= get_smarty();
 
+    /* Assign ACLs */
+    $smarty->assign("acl",$this->parent->getacl(""));
+
     $smarty->assign('ddns_styles', $this->ddns_styles);
     foreach (array('max_lease_time', 'default_lease_time', 'ddns_update_style') as $value){
       if (isset($this->statements[preg_replace('/_/', '-', $value)])){
index f51be78dcc7385d02791932e2946089f00e03634..e512cb663a9369ed23959f7fa098dbb25923f3c6 100644 (file)
@@ -37,6 +37,9 @@ class dhcpSharedNetwork extends dhcpPlugin
   {
     $smarty= get_smarty();
 
+    /* Assign ACLs */
+    $smarty->assign("acl",$this->parent->getacl(""));
+
     /* Fill template */
     $smarty->assign ("cn", $this->cn);
     foreach (array("server-identifier", "default-lease-time", "max-lease-time", "min-lease-time") as $attr){
index 18c02eced427c502c1932a58768f0121c89fbf2c..fe10195ccba46fc2a5b57135d2ac70d1bc2ebf3c 100644 (file)
@@ -57,6 +57,9 @@ class dhcpSubnet extends dhcpPlugin
     $smarty->assign("cn", $this->cn);
     $smarty->assign("dhcp_netmask", $this->dhcpNetMask);
 
+    /* Assign ACLs */
+    $smarty->assign("acl",$this->parent->getacl(""));
+
     /* Prepare range */
     if ($this->use_range){
       $smarty->assign("use_range", "checked");
index 219fa5f8731967dd9869ecdd8c5c21820234be71..9872d70c781c03180de4f06a8939ccf635e446c3 100644 (file)
@@ -121,7 +121,7 @@ class servdhcp extends goService
       $section= $_POST['section'];
       $tmp = new dhcpNewSectionDialog(NULL);
       if (isset($tmp->sectionMap[$section])){
-        $this->dialog= new $section($this->current_object);
+        $this->dialog= new $section($this,$this->current_object);
         $this->current_object= "";
       } else {
         $this->dialog= FALSE;
@@ -154,6 +154,7 @@ class servdhcp extends goService
         }
         $data= $this->dialog->save();
         if ($this->current_object == ""){
+
           /* New object */
           $newsects= array();
           foreach ($this->dhcpSections as $key => $dsc){
@@ -242,7 +243,7 @@ class servdhcp extends goService
         if (isset($this->dhcpObjectCache[$dn])){
           $section= $this->objectType($dn);
           $this->current_object= $dn;
-          $this->dialog= new $section($this->dhcpObjectCache[$dn]);
+          $this->dialog= new $section($this,$this->dhcpObjectCache[$dn]);
         }
       }
 
@@ -264,7 +265,7 @@ class servdhcp extends goService
       if (isset($this->dhcpObjectCache[$dn])){
         $section= $this->objectType($dn);
         $this->current_object= $dn;
-        $this->dialog= new $section($this->dhcpObjectCache[$dn]);
+        $this->dialog= new $section($this,$this->dhcpObjectCache[$dn]);
       }
     }
     
@@ -274,7 +275,7 @@ class servdhcp extends goService
       if (isset($this->dhcpObjectCache[$dn])){
         $section= $this->objectType($dn);
         $this->current_object= $dn;
-        $this->dialog= new $section($this->dhcpObjectCache[$dn]);
+        $this->dialog= new $section($this,$this->dhcpObjectCache[$dn]);
       }
     }
     
index b743a73d6831de6708d0e46a992a6b4bab72b7f9..803fd261cb95e96e4d18085a265b599b30da98bb 100644 (file)
    <br>
    <b>{t}DHCP statements{/t}</b>
    <br>
+{render acl=$acl}
    <select name='dhcpstatements' style="width:100%;" size="14">
     {html_options values=$dhcpstatements output=$dhcpstatements}
    </select>
+{/render}
    <br>
+{render acl=$acl}
    <input type='text' name='addstatement' size='25' maxlength='80'>&nbsp;
+{/render}
+{render acl=$acl}
    <input type='submit' name='add_statement' value='{msgPool type=addButton}'>&nbsp;
+{/render}
+{render acl=$acl}
    <input type='submit' name='delete_statement' value='{msgPool type=delButton}'> 
+{/render}
   </td>
 
   <td>
    <br>
    <b>{t}DHCP options{/t}</b>
    <br>
+{render acl=$acl}
    <select name='dhcpoptions' style="width:100%;" size="14">
     {html_options values=$dhcpoptions output=$dhcpoptions}
    </select>
+{/render}
    <br>
+{render acl=$acl}
    <input type='text' name='addoption' size='25' maxlength='80'>&nbsp;
+{/render}
+{render acl=$acl}
    <input type='submit' name='add_option' value='{msgPool type=addButton}'>&nbsp;
+{/render}
+{render acl=$acl}
    <input type='submit' name='delete_option' value='{msgPool type=delButton}'> 
+{/render}
   </td>
  </tr>
 </table>
index 930fc05ee863a62c339ddf96edf3b5a34abb0c84..ba57fb381fbb005a7c8a7f74581916a6a1bc6eb8 100644 (file)
@@ -6,8 +6,10 @@
    {t}Name{/t}{$must}
   </td> 
   <td>
+{render acl=$acl}
    <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'
         title='{t}Name of group{/t}'>
+{/render}
   </td>
  </tr>
 </table>
index 602c51255288c0ec5b797e58288e62db6249e742..d49c4d68010b52be712b00fc1567ad36dc5868f3 100644 (file)
@@ -7,16 +7,20 @@
     <tr>
      <td>{t}Name{/t}{$must}</td>
      <td>
+{render acl=$acl}
       <input {if $realGosaHost} disabled {/if} id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'
              title='{t}Name of host{/t}'>
+{/render}
      </td>
     </tr>
     <tr>
      <td>{t}Fixed address{/t}</td>
      <td>
+{render acl=$acl}
       <input {if $realGosaHost} disabled {/if} 
                        type='text' name='fixedaddr' size='25' maxlength='80' value='{$fixedaddr}'
              title='{t}Use hostname or IP-address to assign fixed address{/t}'>
+{/render}
      </td>
     </tr>
    </table>
     <tr>
      <td>{t}Hardware type{/t}</td>
      <td>
+{render acl=$acl}
       <select name='hwtype'  {if $realGosaHost} disabled {/if} >
        {html_options options=$hwtypes selected=$hwtype}
       </select>
+{/render}
      </td>
     </tr>
     <tr>
      <td>{t}Hardware address{/t}{$must}</td>
      <td>
+{render acl=$acl}
       <input  {if $realGosaHost}  disabled {/if} type='text' name='dhcpHWAddress' size='20' maxlength='18' value='{$dhcpHWAddress}'>
+{/render}
      </td>
     </tr>
    </table>
index d9374a1951b710e7c7317e6cecd1ebfcef97efda..5716a7eb0ff8b998aa4dc771d990a1ff457378d6 100644 (file)
@@ -7,20 +7,26 @@
     <tr>
      <td>{t}Router{/t}</td>
      <td>
+{render acl=$acl}
       <input id='routers' type='text' name='routers' size='25' maxlength='80' value='{$routers}'
               title='{t}Enter name or IP address of router to be used in this section{/t}'>
+{/render}
      </td>
     </tr>
     <tr>
      <td>{t}Netmask{/t}</td>
      <td>
+{render acl=$acl}
       <input type='text' name='subnet_mask' size='18' maxlength='15' value='{$subnet_mask}'>
+{/render}
      </td>
     </tr>
     <tr>
      <td>{t}Broadcast{/t}</td>
      <td>
+{render acl=$acl}
       <input type='text' name='broadcast_address' size='18' maxlength='15' value='{$broadcast_address}'>
+{/render}
      </td>
     </tr>
    </table>
     <tr>
      <td>{t}Filename{/t}</td>
      <td>
+{render acl=$acl}
       <input type='text' name='filename' size='25' maxlength='80' value='{$filename}'
               title='{t}Enter name of file that will be loaded via tftp after client has started{/t}'>
+{/render}
      </td>
     </tr>
     <tr>
      <td>{t}Next server{/t}</td>
      <td>
+{render acl=$acl}
       <input type='text' name='nextserver' size='25' maxlength='80' value='{$nextserver}'
               title='{t}Enter name of server to retrieve bootimages from{/t}'>
+{/render}
      </td>
     </tr>
    </table>
     <tr>
      <td>{t}Domain{/t}</td>
      <td>
+{render acl=$acl}
       <input type='text' name='domain' size='25' maxlength='80' value='{$domain}'
               title='{t}Name of domain{/t}'>
+{/render}
      </td>
     </tr>
     <tr>
      <td colspan=2>
       <br>
       {t}DNS server{/t}<br>
+{render acl=$acl}
       <select name='dnsserver'  title='{t}List of DNS servers to be propagated{/t}' style="width:350px;" size="4">
        {html_options options=$dnsservers}
       </select>
+{/render}
       <br>
+{render acl=$acl}
       <input type='text' name='addserver' size='25' maxlength='80' title='{t}DNS server do be added{/t}'>&nbsp;
+{/render}
+{render acl=$acl}
       <input type='submit' name='add_dns' value='{msgPool type=addButton}' title='{t}Click here add the selected server to the list{/t}'>
+{/render}
+{render acl=$acl}
       <input type='submit' name='delete_dns' value='{msgPool type=delButton}' title='{t}Click here remove the selected servers from the list{/t}'>
+{/render}
      </td>
     </tr>
     <tr>
      <td colspan=2>
       <p><b>{t}Domain Name Service options{/t}</b></p>
+{render acl=$acl}
       <input type=checkbox name="autohost" value="1" {$autohost}>{t}Assign hostnames found via reverse mapping{/t}
+{/render}
       <br>
+{render acl=$acl}
       <input type=checkbox name="autohostdecl" value="1" {$autohostdecl}>{t}Assign hostnames from host declarations{/t}
+{/render}
      </td>
     </tr>
    </table>
index dcbd05c3dbb0c2fa0b448c532feabd13150e3d5c..7b1ec4f5e456f76e6f71ac1f7c0c74cef6387951 100644 (file)
@@ -4,14 +4,20 @@
  <tr>
   <td width="50%">
    {t}Name{/t}{$must}&nbsp;
+{render acl=$acl}
    <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'
         title='{t}Name of pool{/t}'>
+{/render}
   </td>
   <td>
    {t}Range{/t}{$must}&nbsp;
+{render acl=$acl}
    <input type='text' name='range_start' size='25' maxlength='30' value='{$range_start}'>
+{/render}
    &nbsp;-&nbsp;
+{render acl=$acl}
    <input type='text' name='range_stop' size='25' maxlength='30' value='{$range_stop}'>
+{/render}
   </td>
  </tr>
 </table>
index 6ca515e671c7e29a363289c4f6ed5e4de49daa41..94f709ae7e2d5d4f41dc1a095e4ae0a6c5801dc9 100644 (file)
@@ -3,12 +3,16 @@
 <table width="100%">
  <tr>
   <td width="50%">
+{render acl=$acl}
   <input id='authoritative' type=checkbox name="authoritative" value="1" {$authoritative}> {t}Authoritative service{/t}<br>
+{/render}
   <br>
   {t}Dynamic DNS update{/t} 
+{render acl=$acl}
   <select name='ddns_update_style'  title='{t}Dynamic DNS update style{/t}' size="1">
        {html_options values=$ddns_styles output=$ddns_styles selected=$ddns_update_style}
   </select>
+{/render}
   </td>
 
   <td style='vertical-align:top'>
     <tr>
       <td>{t}Default lease time (s){/t}</td>
       <td>
+{render acl=$acl}
       <input type='text' name='default_lease_time' size='25' maxlength='80' value='{$default_lease_time}' title='{t}Enter default lease time in seconds.{/t}'>
+{/render}
       </td>
     </tr>
     <tr>
       <td>{t}Maximum lease time (s){/t}</td>
       <td>
+{render acl=$acl}
       <input type='text' name='max_lease_time' size='25' maxlength='80' value='{$max_lease_time}' title='{t}Enter maximum lease time in seconds.{/t}'>
+{/render}
       </td>
     </tr>
    </table>
index 374da35004ef10c53f88c630a2b7f5d13b447966..b7467147f0b4026d08bc8af5a316934d1656c52f 100644 (file)
@@ -9,14 +9,18 @@
     <tr>
      <td>{t}Name{/t}{$must}</td>
      <td>
+{render acl=$acl}
       <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}' title='{t}Name for shared network{/t}'>
+{/render}
      </td>
     </tr>
     <tr>
      <td>{t}Server identifier{/t}</td>
      <td>
+{render acl=$acl}
       <input type='text' name='server-identifier' size='25' maxlength='80' value='{$server_identifier}'
        title='{t}Propagated server identifier for this shared network{/t}'>
+{/render}
      </td>
     </tr>
    </table>
    <table>
     <tr>
      <td>
+{render acl=$acl}
       <input type=checkbox name="authoritative" value="1" {$authoritative}
        title="{t}Select if this server is authoritative for this shared network{/t}">{t}Authoritative server{/t}
+{/render}
      </td>
     </tr>
    </table>
     <tr>
      <td>{t}Default lease time{/t}</td>
      <td>
+{render acl=$acl}
       <input type='text' name='default-lease-time' size='10' maxlength='25' value='{$default_lease_time}'
         title='{t}Default lease time{/t}'>&nbsp;{t}seconds{/t}
+{/render}
      </td>
     </tr>
     <tr>
      <td>{t}Max. lease time{/t}</td>
      <td>
+{render acl=$acl}
       <input type='text' name='max-lease-time' size='10' maxlength='25' value='{$max_lease_time}'
         title='{t}Maximum lease time{/t}'>&nbsp;{t}seconds{/t}
+{/render}
      </td>
     </tr>
     <tr>
      <td>{t}Min. lease time{/t}</td>
      <td>
+{render acl=$acl}
       <input type='text' name='min-lease-time' size='10' maxlength='25' value='{$min_lease_time}'
         title='{t}Minimum lease time{/t}'>&nbsp;{t}seconds{/t}
+{/render}
      </td>
     </tr>
    </table>
    <table>
     <tr>
      <td>
+{render acl=$acl}
      <input type=checkbox name="unknown-clients" value="1" {$allow_unknown_state}
         title="{t}Select if unknown clients should get dynamic IP addresses{/t}">{t}Allow unknown clients{/t}
+{/render}
      </td>
     </tr>
     <tr>
      <td>
+{render acl=$acl}
      <input type=checkbox name="bootp" value="1" {$allow_bootp_state}
         title="{t}Select if bootp clients should get dynamic IP addresses{/t}">{t}Allow bootp clients{/t}
+{/render}
      </td>
     </tr>
     <tr>
      <td>
+{render acl=$acl}
      <input type=checkbox name="booting" value="1" {$allow_booting_state}
         title="{t}Select if clients are allowed to boot using this DHCP server{/t}">{t}Allow booting{/t}
+{/render}
      </td>
     </tr>
    </table>
index 05425fbdcb561e246e2aaeaf9e04ea54b3178a8f..7f19551b1e32cfeee5851f2e9746e5983a513d45 100644 (file)
@@ -6,24 +6,41 @@
    <table>
     <tr>
      <td>{t}Network address{/t}{$must}</td>
-     <td><input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'></td>
+     <td>
+{render acl=$acl}
+               <input id='cn' type='text' name='cn' size='25' maxlength='80' value='{$cn}'>
+{/render}
+       </td>
     </tr>
     <tr>
      <td>{t}Netmask{/t}{$must}</td>
-     <td><input type='text' name='dhcp_netmask' size='25' maxlength='80' value='{$dhcp_netmask}'></tr>
+     <td>
+{render acl=$acl}
+               <input type='text' name='dhcp_netmask' size='25' maxlength='80' value='{$dhcp_netmask}'>
+{/render}
+       </tr>
    </table>
   </td>
   <td style='vertical-align:top'>
    <table>
     <tr>
-     <td><input type="checkbox" name="use_range" value="1" onChange="changeState('range_start');changeState('range_stop');" {$use_range}></td>
+     <td>
+{render acl=$acl}
+               <input type="checkbox" name="use_range" value="1" 
+                       onChange="changeState('range_start');changeState('range_stop');" {$use_range}></td>
+{/render}
      <td>{t}Range for dynamic address assignment{/t}</td>
   </tr>
   <tr>
   <td>&nbsp;</td>
-  <td><input type='text' id='range_start' name='range_start' size='25' maxlength='80' value='{$range_start}' {$range_disabled}>
+  <td>
+{render acl=$acl}
+       <input type='text' id='range_start' name='range_start' size='25' maxlength='80' value='{$range_start}' {$range_disabled}>
+{/render}
   &nbsp;<b>-</b>&nbsp;
+{render acl=$acl}
   <input type='text' id='range_stop' name='range_stop' size='25' maxlength='80' value='{$range_stop}' {$range_disabled}>
+{/render}
   </td>
   </tr>
   </table>