From 657fc912bf4394066aacaefb1fcc580125d56c63 Mon Sep 17 00:00:00 2001 From: jf-cbd <121934370+jf-cbd@users.noreply.github.com> Date: Mon, 2 Jun 2025 16:09:29 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B08198=20-=20ModuleInstallation=20now=20ex?= =?UTF-8?q?tends=20DBObject=20+=20better=20exception=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/moduleinstallation.class.inc.php | 2 +- sources/Controller/Base/Layout/ObjectController.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup/moduleinstallation.class.inc.php b/setup/moduleinstallation.class.inc.php index 81b68a55a..535f22daf 100644 --- a/setup/moduleinstallation.class.inc.php +++ b/setup/moduleinstallation.class.inc.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/AGPL-3.0 */ -class ModuleInstallation extends cmdbAbstractObject +class ModuleInstallation extends DBObject { public static function Init() { diff --git a/sources/Controller/Base/Layout/ObjectController.php b/sources/Controller/Base/Layout/ObjectController.php index 137d7827a..84db6f59e 100644 --- a/sources/Controller/Base/Layout/ObjectController.php +++ b/sources/Controller/Base/Layout/ObjectController.php @@ -82,7 +82,9 @@ class ObjectController extends AbstractController { throw new ApplicationException(Dict::Format('UI:Error:1ParametersMissing', 'class')); } - + if (!is_subclass_of($sClass, cmdbAbstractObject::class)) { + throw new SecurityException('The class "'.$sClass.'" is not a subclass of cmdbAbstractObject so it can\'t be created by the user'); + } // If the specified class has subclasses, ask the user an instance of which class to create $aSubClasses = MetaModel::EnumChildClasses($sClass, ENUM_CHILD_CLASSES_ALL); // Including the specified class itself $aPossibleClasses = array();