monitoring/security: Hide 'Process check result' link if user lacks the respective permission

This commit is contained in:
Eric Lippmann 2015-01-23 10:48:21 +01:00
parent 2535d802b1
commit 08e8d5d742

View File

@ -3,25 +3,32 @@
$parts = explode('!', $object->check_command); $parts = explode('!', $object->check_command);
$command = array_shift($parts); $command = array_shift($parts);
?><tr class="newsection"> ?>
<th><?= $this->translate('Command') ?></th>
<td> <tr class="newsection">
<?= $this->escape($command) ?> <th><?= $this->translate('Command') ?></th>
<?php if ($object->passive_checks_enabled): ?> <td>
<?php if ($object->getType() === $object::TYPE_HOST): ?> <?= $this->escape($command) ?>
<a href="<?= $this->href( <?php if ($this->hasPermission('monitoring/command/schedule-check') && $object->passive_checks_enabled): ?>
'monitoring/host/process-check-result', <?php if ($object->getType() === $object::TYPE_HOST) {
array('host' => $object->getName()) $processCheckResult = $this->href(
); ?>"><?= $this->icon('reply'); ?> <?= $this->translate('Process check result'); ?></a> 'monitoring/host/process-check-result',
<?php else: ?> array('host' => $object->getName())
<a href="<?= $this->href( );
'monitoring/service/process-check-result', } else {
array('host' => $object->getHost()->getName(), 'service' => $object->getName()) $processCheckResult = $this->href(
); ?>"><?= $this->icon('reply'); ?> <?= $this->translate('Process check result'); ?></a> 'monitoring/service/process-check-result',
<?php endif ?> array('host' => $object->getHost()->getName(), 'service' => $object->getName())
<?php endif ?> );
</td> } ?>
<a href="<?= $processCheckResult ?>">
<?= $this->icon('reply') ?>
<?= $this->translate('Process check result') ?>
</a>
<?php endif ?>
</td>
</tr> </tr>
<?php <?php
$row = "<tr>\n <th>%s</th>\n <td>%s</td>\n</tr>\n"; $row = "<tr>\n <th>%s</th>\n <td>%s</td>\n</tr>\n";