From 7e4b92b71449894c994874116b009a6a571cfe75 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 16 Aug 2018 17:03:42 +0200 Subject: [PATCH] Fix permission test in Hook::has() Before, only the first hook for the given type was tested. If this hook belonged to a not permitted module, Hook::has() returned false. Though there may have been other hooks which are permitted. --- library/Icinga/Application/Hook.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/Icinga/Application/Hook.php b/library/Icinga/Application/Hook.php index 185dcd59a..85d18a56d 100644 --- a/library/Icinga/Application/Hook.php +++ b/library/Icinga/Application/Hook.php @@ -75,11 +75,13 @@ class Hook return false; } - $hook = self::$hooks[$name]; - // $hook is in the format key => value - $hook = reset($hook); + foreach (self::$hooks[$name] as $hook) { + if (self::hasPermission($hook)) { + return true; + } + } - return self::hasPermission($hook); + return false; } protected static function normalizeHookName($name)