projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
be40a9f
)
torrus: add new access rights, add SNMP community option, RT10574
author
levinse
<levinse>
Sun, 15 May 2011 01:43:40 +0000
(
01:43
+0000)
committer
levinse
<levinse>
Sun, 15 May 2011 01:43:40 +0000
(
01:43
+0000)
FS/FS/AccessRight.pm
patch
|
blob
|
history
FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
patch
|
blob
|
history
httemplate/elements/menu.html
patch
|
blob
|
history
httemplate/misc/nms-add_router.html
patch
|
blob
|
history
httemplate/misc/process/nms-add_iface.html
patch
|
blob
|
history
httemplate/misc/process/nms-add_router.html
patch
|
blob
|
history
diff --git
a/FS/FS/AccessRight.pm
b/FS/FS/AccessRight.pm
index
c3aeb2d
..
2f6f531
100644
(file)
--- a/
FS/FS/AccessRight.pm
+++ b/
FS/FS/AccessRight.pm
@@
-311,6
+311,8
@@
tie my %rights, 'Tie::IxHash',
{ rightname=>'Broadband configuration' },
{ rightname=>'Broadband global configuration', global=>1 },
{ rightname=>'Broadband configuration' },
{ rightname=>'Broadband global configuration', global=>1 },
+
+ { rightname=> 'Configure network monitoring', global=>1 },
#{ rightname=>'Edit employees', global=>1, },
#{ rightname=>'Edit employee groupss', global=>1, },
#{ rightname=>'Edit employees', global=>1, },
#{ rightname=>'Edit employee groupss', global=>1, },
diff --git
a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
index
9df1975
..
bd016a1
100644
(file)
--- a/
FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
+++ b/
FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
@@
-155,11
+155,14
@@
sub report {
}
sub add_router {
}
sub add_router {
- my($self, $ip) = @_;
+ my($self, $ip, $community) = @_;
+
+ $community = qq!<param name="snmp-community" value="$community"/>\n !
+ if length($community) > 1;
my $newhost =
qq( <host>\n).
my $newhost =
qq( <host>\n).
- qq( <param name="snmp-host" value="$ip"/>\n).
+ qq( <param name="snmp-host" value="$ip"/>\n).
$community.
qq( </host>\n);
my $ddx = $self->_torrus_loadddx;
qq( </host>\n);
my $ddx = $self->_torrus_loadddx;
diff --git
a/httemplate/elements/menu.html
b/httemplate/elements/menu.html
index
e28beb7
..
5e2e548
100644
(file)
--- 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' ],
}
$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
35ef7bf
..
c41e619
100644
(file)
--- a/
httemplate/misc/nms-add_router.html
+++ b/
httemplate/misc/nms-add_router.html
@@
-7,6
+7,13
@@
Router Hostname/IP
)
%>
<BR>
)
%>
<BR>
+SNMP Community String (optional)
+<% include('/elements/input-text.html',
+ 'field' => 'community',
+ )
+%>
+<BR>
+<BR>
<INPUT TYPE="submit" NAME="submit" ID="submit_nms-add_router" VALUE="Add Router">
</FORM>
<INPUT TYPE="submit" NAME="submit" ID="submit_nms-add_router" VALUE="Add Router">
</FORM>
diff --git
a/httemplate/misc/process/nms-add_iface.html
b/httemplate/misc/process/nms-add_iface.html
index
0d37ea2
..
5f51e5c
100644
(file)
--- a/
httemplate/misc/process/nms-add_iface.html
+++ b/
httemplate/misc/process/nms-add_iface.html
@@
-5,7
+5,8
@@
</BODY></HTML>
<%init>
</BODY></HTML>
<%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 $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
bc437d2
..
a77d897
100644
(file)
--- a/
httemplate/misc/process/nms-add_router.html
+++ b/
httemplate/misc/process/nms-add_router.html
@@
-2,12
+2,16
@@
</BODY></HTML>
<%init>
</BODY></HTML>
<%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 $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;
my $nms = new FS::NetworkMonitoringSystem;
-$nms->add_router($host);
+$nms->add_router($host
,$community
);
</%init>
</%init>