From b412c2545d8862278343adc1ef17cc297e11ad6d Mon Sep 17 00:00:00 2001 From: levinse Date: Sun, 15 May 2011 01:43:40 +0000 Subject: torrus: add new access rights, add SNMP community option, RT10574 --- httemplate/elements/menu.html | 3 ++- httemplate/misc/nms-add_router.html | 7 +++++++ httemplate/misc/process/nms-add_iface.html | 3 ++- httemplate/misc/process/nms-add_router.html | 8 ++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) (limited to 'httemplate') diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index e28beb760..5e2e54835 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -638,7 +638,8 @@ if ( $conf->config('ticket_system') ) { ], } -if ( $conf->config('network_monitoring_system') eq 'Torrus_Internal' ) { +if ( $conf->config('network_monitoring_system') eq 'Torrus_Internal' && + $curuser->access_right('Configure network monitoring') ) { $menu{'Network Main'} = [ $fsurl.'torrus/main', 'Network monitoring start page' ], } diff --git a/httemplate/misc/nms-add_router.html b/httemplate/misc/nms-add_router.html index 35ef7bf72..c41e61977 100644 --- a/httemplate/misc/nms-add_router.html +++ b/httemplate/misc/nms-add_router.html @@ -7,6 +7,13 @@ Router Hostname/IP ) %>
+SNMP Community String (optional) +<% include('/elements/input-text.html', + 'field' => 'community', + ) +%> +
+
diff --git a/httemplate/misc/process/nms-add_iface.html b/httemplate/misc/process/nms-add_iface.html index 0d37ea233..5f51e5ce1 100644 --- a/httemplate/misc/process/nms-add_iface.html +++ b/httemplate/misc/process/nms-add_iface.html @@ -5,7 +5,8 @@ <%init> -# XXX: access rights +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configure network monitoring'); my $host = $cgi->param('host'); die 'invalid host' unless $host =~ /^[0-9.a-zA-Z\-]+$/; diff --git a/httemplate/misc/process/nms-add_router.html b/httemplate/misc/process/nms-add_router.html index bc437d2b3..a77d897d2 100644 --- a/httemplate/misc/process/nms-add_router.html +++ b/httemplate/misc/process/nms-add_router.html @@ -2,12 +2,16 @@ <%init> -# XXX: access rights +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configure network monitoring'); my $host = $cgi->param('host'); die 'invalid host' unless $host =~ /^[0-9.a-zA-Z\-]+$/; +my $community = $cgi->param('community'); +die 'invalid SNMP community string' unless $community =~ /^[0-9.a-zA-Z\-]*$/; + my $nms = new FS::NetworkMonitoringSystem; -$nms->add_router($host); +$nms->add_router($host,$community); -- cgit v1.2.1