import torrus 1.0.9
[freeside.git] / httemplate / edit / process / addr_block / add.cgi
index 85780c6..39d6348 100755 (executable)
@@ -1,21 +1,20 @@
-%
-%
-%my $error = '';
-%my $ip_gateway = $cgi->param('ip_gateway');
-%my $ip_netmask = $cgi->param('ip_netmask');
-%
-%my $new = new FS::addr_block {
-%    ip_gateway => $ip_gateway,
-%    ip_netmask => $ip_netmask,
-%    routernum  => 0 };
-%
-%$error = $new->insert;
-%
-%if ( $error ) {
-%  $cgi->param('error', $error);
-%  print $cgi->redirect(popurl(4). "browse/addr_block.cgi?". $cgi->query_string );
-%} else { 
-%  print $cgi->redirect(popurl(4). "browse/addr_block.cgi");
-%} 
-%
+<% include( '../elements/process.html',
+            'table'            => 'addr_block',
+            'redirect'         => popurl(4). 'browse/addr_block.cgi?dummy=',
+            'error_redirect'   => popurl(4). 'browse/addr_block.cgi?',
+            'agent_virt'       => 1,
+            'agent_null_right' => 'Broadband global configuration',
 
+          )
+%>
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+die "access denied"
+  unless $curuser->access_right('Broadband configuration')
+      || $curuser->access_right('Broadband global configuration');
+
+$cgi->param('routernum', 0)           # in FS::addr_block::check instead?
+  unless $cgi->param('routernum');
+
+</%init>