Allow Port Control users to see Port Config Log report
This commit is contained in:
		| @@ -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', | ||||
|   | ||||
| @@ -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 }; | ||||
| }; | ||||
		Reference in New Issue
	
	Block a user