Respect permission for check now on multiple hosts

refs #10397
This commit is contained in:
Alexander A. Klimov 2016-02-12 16:35:50 +01:00 committed by Eric Lippmann
parent 67b1309834
commit 23841b635e
2 changed files with 13 additions and 9 deletions

View File

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

View File

@ -174,10 +174,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>