From b18bc644404e02b57635bfcc8258e85abb141146 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:44:46 +0200 Subject: Adding upstream version 1.1.1. Signed-off-by: Daniel Baumann --- library/Icingadb/Hook/IcingadbSupportHook.php | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 library/Icingadb/Hook/IcingadbSupportHook.php (limited to 'library/Icingadb/Hook/IcingadbSupportHook.php') diff --git a/library/Icingadb/Hook/IcingadbSupportHook.php b/library/Icingadb/Hook/IcingadbSupportHook.php new file mode 100644 index 0000000..96cdd19 --- /dev/null +++ b/library/Icingadb/Hook/IcingadbSupportHook.php @@ -0,0 +1,52 @@ +getNamespace('icingadb') + ->get(self::PREFERENCE_NAME, false); + } + + /** + * Whether to use icingadb as the backend + * + * @return bool Returns true if monitoring module is accessible or icingadb is selected as backend, false otherwise. + */ + final public static function useIcingaDbAsBackend(): bool + { + return ! Icinga::app()->getModuleManager()->hasEnabled('monitoring') + || ! Auth::getInstance()->hasPermission('module/monitoring') + || self::isIcingaDbSetAsPreferredBackend(); + } +} -- cgit v1.2.3