Skip to content

Commit

Permalink
Host|ServiceActions: Don't check object access if monitoring isn't ac…
Browse files Browse the repository at this point in the history
…tive
  • Loading branch information
nilmerg authored and Thomas-Gelf committed Sep 1, 2021
1 parent 435b1f9 commit 82ae0dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library/Director/ProvidedHook/Monitoring/HostActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function getThem(Host $host)
$auth = Auth::getInstance();
if (Util::hasPermission('director/monitoring/hosts')) {
$monitoring = new Monitoring();
if ($monitoring->authCanEditHost($auth, $hostname)) {
if ($monitoring->isAvailable() && $monitoring->authCanEditHost($auth, $hostname)) {
$allowEdit = IcingaHost::exists($hostname, $db);
}
}
Expand Down
5 changes: 4 additions & 1 deletion library/Director/ProvidedHook/Monitoring/ServiceActions.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ protected function getThem(Service $service)
$title = mt('director', 'Modify');
} elseif (Util::hasPermission('director/monitoring/services')) {
$monitoring = new Monitoring();
if ($monitoring->authCanEditService(Auth::getInstance(), $hostname, $serviceName)) {
if (
$monitoring->isAvailable()
&& $monitoring->authCanEditService(Auth::getInstance(), $hostname, $serviceName)
) {
$title = mt('director', 'Modify');
}
} elseif (Util::hasPermission('director/monitoring/services-ro')) {
Expand Down

0 comments on commit 82ae0dc

Please sign in to comment.