mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
monitoring/security: Hide 'Add comment' link if user lacks the respective permission
This commit is contained in:
parent
cd8822ceff
commit
67be1b329b
@ -3,7 +3,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** @var \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
/** @type \Icinga\Module\Monitoring\Object\MonitoredObject $object */
|
||||||
|
|
||||||
if ($object->getType() === $object::TYPE_HOST) {
|
if ($object->getType() === $object::TYPE_HOST) {
|
||||||
$addCommentLink = $this->href(
|
$addCommentLink = $this->href(
|
||||||
@ -18,9 +18,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?php if ($this->hasPermission('monitoring/command/comment/add')): ?>
|
||||||
<a href="<?= $addCommentLink ?>">
|
<a href="<?= $addCommentLink ?>">
|
||||||
<?= $this->icon('comment') ?> <?= $this->translate('Add comment') ?>
|
<?= $this->icon('comment') ?>
|
||||||
|
<?= $this->translate('Add comment') ?>
|
||||||
</a>
|
</a>
|
||||||
|
<?php else: ?>
|
||||||
|
<?= '-' ?>
|
||||||
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@ -43,9 +49,9 @@ foreach ($object->comments as $comment) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td style="vertical-align: top;" data-base-target="_self">
|
<td style="vertical-align: top;" data-base-target="_self">
|
||||||
<?php if (isset($delCommentForm)) { // Form is unset if the current user lacks the respective permission
|
<?php if (isset($delCommentForm)) { // Form is unset if the current user lacks the respective permission
|
||||||
$form = clone $delCommentForm;
|
$delCommentForm = clone $delCommentForm;
|
||||||
$form->populate(array('comment_id' => $comment->id));
|
$delCommentForm->populate(array('comment_id' => $comment->id));
|
||||||
echo $form;
|
echo $delCommentForm;
|
||||||
} ?>
|
} ?>
|
||||||
(<?= ucfirst($comment->type) ?>):
|
(<?= ucfirst($comment->type) ?>):
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user