-<%
+<% 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',
-my $error = '';
-my $ip_gateway = $cgi->param('ip_gateway');
-my $ip_netmask = $cgi->param('ip_netmask');
+ )
+%>
+<%init>
-my $new = new FS::addr_block {
- ip_gateway => $ip_gateway,
- ip_netmask => $ip_netmask,
- routernum => 0 };
+my $curuser = $FS::CurrentUser::CurrentUser;
+die "access denied"
+ unless $curuser->access_right('Broadband configuration')
+ || $curuser->access_right('Broadband global configuration');
-$error = $new->insert;
+$cgi->param('routernum', 0) # in FS::addr_block::check instead?
+ unless $cgi->param('routernum');
-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");
-}
-%>
+</%init>