ProvidedHook/Monitoring: check permissions

fixes #1784
This commit is contained in:
Thomas Gelf 2019-02-12 11:56:01 +01:00
parent 57c256cf91
commit 44e9ec2867
2 changed files with 10 additions and 2 deletions

View File

@ -37,7 +37,7 @@ class HostActions extends HostActionsHook
);
}
if (IcingaHost::exists($hostname, $db)) {
if (Util::hasPermission('director/hosts') && IcingaHost::exists($hostname, $db)) {
$actions['Modify'] = Url::fromPath(
'director/host/edit',
array('name' => $hostname)

View File

@ -48,8 +48,16 @@ class ServiceActions extends ServiceActionsHook
]);
}
if (Util::hasPermission('director/hosts')) {
$title = mt('director', 'Modify');
} elseif (Util::hasPermission('director/monitoring/services-ro')) {
$title = mt('director', 'Configuration');
} else {
return $actions;
}
if (IcingaHost::exists($hostname, $db)) {
$actions['Modify'] = Url::fromPath('director/host/findservice', [
$actions[$title] = Url::fromPath('director/host/findservice', [
'name' => $hostname,
'service' => $service->service_description
]);