fix: Non-admin reports require admin login

This commit is contained in:
Oliver Gorwits
2015-10-13 22:28:15 +01:00
parent 98165b75c3
commit 4ee916fd05
3 changed files with 6 additions and 8 deletions

View File

@@ -4,6 +4,10 @@
* Filter by VLAN in Pors with Multiple Nodes report * Filter by VLAN in Pors with Multiple Nodes report
[BUG FIXES]
* Non-admin reports require admin login
2.033002 - 2015-09-29 2.033002 - 2015-09-29
[ENHANCEMENTS] [ENHANCEMENTS]

View File

@@ -15,19 +15,14 @@ register_report(
} }
); );
get '/ajax/content/report/apradiochannelpower/data' => require_role admin => get '/ajax/content/report/apradiochannelpower/data' => require_login sub {
sub {
send_error( 'Missing parameter', 400 ) send_error( 'Missing parameter', 400 )
unless ( param('draw') && param('draw') =~ /\d+/ ); unless ( param('draw') && param('draw') =~ /\d+/ );
my $rs = schema('netdisco')->resultset('Virtual::ApRadioChannelPower'); my $rs = schema('netdisco')->resultset('Virtual::ApRadioChannelPower');
my $exp_params = expand_hash( scalar params ); my $exp_params = expand_hash( scalar params );
my $recordsTotal = $rs->count; my $recordsTotal = $rs->count;
my @data = $rs->get_datatables_data($exp_params)->hri->all; my @data = $rs->get_datatables_data($exp_params)->hri->all;
my $recordsFiltered = $rs->get_datatables_filtered_count($exp_params); my $recordsFiltered = $rs->get_datatables_filtered_count($exp_params);
content_type 'application/json'; content_type 'application/json';
@@ -46,7 +41,6 @@ get '/ajax/content/report/apradiochannelpower' => require_login sub {
template 'ajax/report/apradiochannelpower.tt', {}, template 'ajax/report/apradiochannelpower.tt', {},
{ layout => undef }; { layout => undef };
} }
else { else {
my @results my @results
= schema('netdisco')->resultset('Virtual::ApRadioChannelPower') = schema('netdisco')->resultset('Virtual::ApRadioChannelPower')

View File

@@ -15,7 +15,7 @@ register_report(
} }
); );
get '/ajax/content/report/devicepoestatus/data' => require_role admin => sub { get '/ajax/content/report/devicepoestatus/data' => require_login sub {
send_error( 'Missing parameter', 400 ) send_error( 'Missing parameter', 400 )
unless ( param('draw') && param('draw') =~ /\d+/ ); unless ( param('draw') && param('draw') =~ /\d+/ );