From 48bf9543879fecd9e8fdc55a310ddb20dbd78cb1 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Mon, 16 Nov 2020 11:21:20 +0100 Subject: [PATCH] :loud_sound: DisplayBlock add error message on error if user is admin Previously only an IssueLog was made, which was confusing The log is limited to admin users as it contains the exception message, which could expose sensitive info --- application/displayblock.class.inc.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 12b0ec042..fbc10fb2d 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -17,6 +17,7 @@ * You should have received a copy of the GNU Affero General Public License */ +use Combodo\iTop\Application\UI\Component\Alert\AlertFactory; use Combodo\iTop\Application\UI\Component\Badge\BadgeFactory; use Combodo\iTop\Application\UI\Component\Button\ButtonFactory; use Combodo\iTop\Application\UI\Component\Dashlet\DashletFactory; @@ -242,6 +243,14 @@ class DisplayBlock try { $oHtml->AddSubBlock($this->GetRenderContent($oPage, $aExtraParams, $sId)); } catch (Exception $e) { + if (UserRights::IsAdministrator()) { + $sExceptionContent = << +{$e->getMessage()} +HTML; + $oExceptionAlert = AlertFactory::MakeForFailure('Cannot display results', $sExceptionContent); + $oHtml->AddSubBlock($oExceptionAlert); + } IssueLog::Error('Exception during GetDisplay: '.$e->getMessage()); } $oHtml->AddHtml("\n");