From 84684b3b5be3e711ac17bacc108a41ad61c2bf35 Mon Sep 17 00:00:00 2001 From: Maxime Besson Date: Thu, 28 Jan 2021 11:28:14 +0100 Subject: [PATCH] Avoid loading plugins when their config is an empty hash (#2448) --- .../lib/Lemonldap/NG/Portal/Main/Plugins.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Plugins.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Plugins.pm index b36d3ca1b..189e32b8d 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Plugins.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Plugins.pm @@ -63,7 +63,15 @@ sub enabledPlugins { # Load static plugin list for ( my $i = 0 ; $i < @pList ; $i += 2 ) { - push @res, $pList[ $i + 1 ] if ( $conf->{ $pList[$i] } ); + my $pluginConf = $conf->{ $pList[$i] }; + if ( ref($pluginConf) eq "HASH" ) { + + # Do not load plugin if config is an empty hash + push @res, $pList[ $i + 1 ] if %{$pluginConf}; + } + else { + push @res, $pList[ $i + 1 ] if $pluginConf; + } } # Check if SOAP is enabled