monitoring/security: Guard the link for disabling notifications on an instance-wide basis

The link in the monitoring health view will only be shown if the user has the permission monitoring/command/feature/instance.
This commit is contained in:
Eric Lippmann 2015-01-30 10:26:43 +01:00
parent 3716be4a48
commit 35b33647cf
1 changed files with 10 additions and 6 deletions

View File

@ -59,12 +59,16 @@ class ToggleInstanceFeaturesCommandForm extends CommandForm
public function createElements(array $formData = array())
{
if ((bool) $this->status->notifications_enabled) {
$notificationDescription = sprintf(
'<a title="%s" href="%s" data-base-target="_next">%s</a>',
$this->translate('Disable notifications for a specific time on a program-wide basis'),
$this->getView()->href('monitoring/process/disable-notifications'),
$this->translate('Disable temporarily')
);
if ($this->hasPermission('monitoring/command/feature/instance')) {
$notificationDescription = sprintf(
'<a title="%s" href="%s" data-base-target="_next">%s</a>',
$this->translate('Disable notifications for a specific time on a program-wide basis'),
$this->getView()->href('monitoring/process/disable-notifications'),
$this->translate('Disable temporarily')
);
} else {
$notificationDescription = null;
}
} elseif ($this->status->disable_notif_expire_time) {
$notificationDescription = sprintf(
$this->translate('Notifications will be re-enabled in <strong>%s</strong>'),