monitoring/security: Hide 'Check Now' action if user lacks the respective permission
This commit is contained in:
parent
44de790cc9
commit
a09ba15859
|
@ -23,7 +23,9 @@ if ($object->getType() === $object::TYPE_HOST) {
|
|||
<tr>
|
||||
<th><?= $this->translate('Last check') ?></th>
|
||||
<td data-base-target="_self">
|
||||
<?= $checkNowForm ?>
|
||||
<?php if (isset($checkNowForm)) { // Form is unset if the current user lacks the respective permission
|
||||
echo $checkNowForm;
|
||||
} ?>
|
||||
<?= $this->timeSince($object->last_check) ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -57,11 +57,14 @@ abstract class MonitoredObjectController extends Controller
|
|||
public function showAction()
|
||||
{
|
||||
$this->setAutorefreshInterval(10);
|
||||
$checkNowForm = new CheckNowCommandForm();
|
||||
$checkNowForm
|
||||
->setObjects($this->object)
|
||||
->handleRequest();
|
||||
$this->view->checkNowForm = $checkNowForm;
|
||||
$auth = $this->Auth();
|
||||
if ($auth->hasPermission('monitoring/command/schedule-check')) {
|
||||
$checkNowForm = new CheckNowCommandForm();
|
||||
$checkNowForm
|
||||
->setObjects($this->object)
|
||||
->handleRequest();
|
||||
$this->view->checkNowForm = $checkNowForm;
|
||||
}
|
||||
if ( ! in_array((int) $this->object->state, array(0, 99))) {
|
||||
if ((bool) $this->object->acknowledged) {
|
||||
$removeAckForm = new RemoveAcknowledgementCommandForm();
|
||||
|
|
Loading…
Reference in New Issue