From a6dad054454f16b027fe1ff00a5fbb5daf07383d Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Fri, 12 Nov 2021 12:07:40 +0100 Subject: [PATCH] BpConfigBaseForm: Only add backends of enabled modules --- .../Businessprocess/Web/Form/BpConfigBaseForm.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/library/Businessprocess/Web/Form/BpConfigBaseForm.php b/library/Businessprocess/Web/Form/BpConfigBaseForm.php index 437d68d..92f09ea 100644 --- a/library/Businessprocess/Web/Form/BpConfigBaseForm.php +++ b/library/Businessprocess/Web/Form/BpConfigBaseForm.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Businessprocess\Web\Form; use Icinga\Application\Config; +use Icinga\Application\Icinga; use Icinga\Authentication\Auth; use Icinga\Module\Businessprocess\Storage\LegacyStorage; use Icinga\Module\Businessprocess\BpConfig; @@ -17,9 +18,17 @@ abstract class BpConfigBaseForm extends QuickForm protected function listAvailableBackends() { - $keys = array_keys(Config::module('monitoring', 'backends')->toArray()); - $keys = array_combine($keys, $keys); - $keys['_icingadb'] = 'Icinga DB'; + $keys = []; + $moduleManager = Icinga::app()->getModuleManager(); + if ($moduleManager->hasEnabled('monitoring')) { + $keys = array_keys(Config::module('monitoring', 'backends')->toArray()); + $keys = array_combine($keys, $keys); + } + + if ($moduleManager->hasEnabled('icingadb')) { + $keys['_icingadb'] = 'Icinga DB'; + } + return $keys; }