Allow Port Control users to see Port Config Log report

This commit is contained in:
Oliver Gorwits
2014-02-14 19:38:54 +00:00
parent e2fef8285b
commit e3ae76cea2
12 changed files with 31 additions and 18 deletions

View File

@@ -178,6 +178,16 @@ any query parameters which might customize the report search.
See the L<App::Netdisco::Web::Plugin::Report::DuplexMismatch> module for a
simple example of how to implement the handler.
An additional feature allows you to create Reports which do not appear in the
Navbar menu. This is useful if the page is only linked directly from another
(for example Port Log). To enable this feature add the C<hidden> key:
register_report({
tag => 'newfeature',
label => 'My New Feature',
hidden => true,
});
=head1 CSV Response
Most pages in Netdisco are a table with data. It's possible to have the
@@ -224,7 +234,7 @@ want arbitrary links supported.
An additional feature allows you to create Admin Tasks which do not appear in
the Navbar menu. This is useful if the page is only linked directly from
another (for example Port Log). To enable this feature add the C<hidden> key:
another. To enable this feature add the C<hidden> key:
register_admin_task({
tag => 'newfeature',

View File

@@ -1,4 +1,4 @@
package App::Netdisco::Web::Plugin::AdminTask::PortLog;
package App::Netdisco::Web::Plugin::Report::PortLog;
use Dancer ':syntax';
use Dancer::Plugin::Ajax;
@@ -7,13 +7,14 @@ use Dancer::Plugin::Auth::Extensible;
use App::Netdisco::Web::Plugin;
register_admin_task({
register_report({
tag => 'portlog',
label => 'Port Control Log',
category => 'Port', # not used
hidden => true,
});
ajax '/ajax/content/admin/portlog' => require_role admin => sub {
ajax '/ajax/content/report/portlog' => require_role port_control => sub {
my $device = param('q');
my $port = param('f');
send_error('Bad Request', 400) unless $device and $port;
@@ -31,7 +32,7 @@ ajax '/ajax/content/admin/portlog' => require_role admin => sub {
})->with_times;
content_type('text/html');
template 'ajax/admintask/portlog.tt', {
template 'ajax/report/portlog.tt', {
results => $set,
}, { layout => undef };
};