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; 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): ?> if ($object->acknowledged): ?>
<tr> <tr>
<th><?= $this->translate('Acknowledged') ?></th> <th><?= $this->translate('Acknowledged') ?></th>
@ -34,12 +22,25 @@ if ($object->acknowledged): ?>
<tr> <tr>
<th><?= $this->translate('Not acknowledged') ?></th> <th><?= $this->translate('Not acknowledged') ?></th>
<td> <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 ?>"> <a href="<?= $ackLink ?>">
<?= $this->icon('ok') ?> <?= $this->translate('Acknowledge') ?> <?= $this->icon('ok') ?> <?= $this->translate('Acknowledge') ?>
</a> </a>
<?php } else {
echo '&#45;';
} // endif ?>
</td> </td>
</tr> </tr>
<?php endif ?> <?php endif ?>

View File

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

View File

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