Respect permission for check now on multiple services

refs 
This commit is contained in:
Alexander A. Klimov 2016-02-12 16:39:06 +01:00 committed by Eric Lippmann
parent 23841b635e
commit d257c71c54
2 changed files with 13 additions and 9 deletions
modules/monitoring/application
controllers
views/scripts/services

View File

@ -90,11 +90,13 @@ class ServicesController extends Controller
public function showAction()
{
$this->setAutorefreshInterval(15);
$checkNowForm = new CheckNowCommandForm();
$checkNowForm
->setObjects($this->serviceList)
->handleRequest();
$this->view->checkNowForm = $checkNowForm;
if ($this->Auth()->hasPermission('monitoring/command/schedule-check')) {
$checkNowForm = new CheckNowCommandForm();
$checkNowForm
->setObjects($this->serviceList)
->handleRequest();
$this->view->checkNowForm = $checkNowForm;
}
$acknowledgedObjects = $this->serviceList->getAcknowledgedObjects();
if (! empty($acknowledgedObjects)) {

View File

@ -176,10 +176,12 @@
</td>
</tr>
<tr>
<th> <?= $this->translate('Schedule Check') ?> </th>
<td> <?= $checkNowForm ?> </td>
</tr>
<?php if (isset($checkNowForm)): // Form is unset if the current user lacks the respective permission ?>
<tr>
<th> <?= $this->translate('Schedule Check') ?> </th>
<td> <?= $checkNowForm ?> </td>
</tr>
<?php endif ?>
<tr>
<th></th>