monitoring/security: Hide 'Acknowledge' link if user lacks the respective permission

This commit is contained in:
Eric Lippmann 2015-01-23 11:01:47 +01:00
parent 08e8d5d742
commit 3cb2dd0e8b
3 changed files with 17 additions and 16 deletions

View File

@ -7,18 +7,6 @@ if (in_array((int) $object->state, array(0, 99))) {
return;
}
if ($object->getType() === $object::TYPE_HOST) {
$ackLink = $this->href(
'monitoring/host/acknowledge-problem',
array('host' => $object->getName())
);
} else {
$ackLink = $this->href(
'monitoring/service/acknowledge-problem',
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
);
}
if ($object->acknowledged): ?>
<tr>
<th><?= $this->translate('Acknowledged') ?></th>
@ -34,12 +22,25 @@ if ($object->acknowledged): ?>
<tr>
<th><?= $this->translate('Not acknowledged') ?></th>
<td>
<?php
<?php if ($this->hasPermission('monitoring/command/acknowledge-problem')) {
if ($object->getType() === $object::TYPE_HOST) {
$ackLink = $this->href(
'monitoring/host/acknowledge-problem',
array('host' => $object->getName())
);
} else {
$ackLink = $this->href(
'monitoring/service/acknowledge-problem',
array('host' => $object->getHost()->getName(), 'service' => $object->getName())
);
}
?>
<a href="<?= $ackLink ?>">
<?= $this->icon('ok') ?> <?= $this->translate('Acknowledge') ?>
</a>
<?php } else {
echo '&#45;';
} // endif ?>
</td>
</tr>
<?php endif ?>

View File

@ -21,7 +21,7 @@
</a>
<?php } else {
echo '&#45;';
} ?>
} // endif ?>
</td>
</tr>

View File

@ -21,7 +21,7 @@
</a>
<?php } else {
echo '&#45;';
} ?>
} // endif ?>
</td>
</tr>