From 121635d63602536866ce5ff54fdfc65ac2bdf692 Mon Sep 17 00:00:00 2001 From: Guillaume Lajarige Date: Mon, 3 Jul 2017 14:24:59 +0000 Subject: [PATCH] =?UTF-8?q?N=C2=B0642=20Portal:=20Flags=20on=20transition?= =?UTF-8?q?=20part=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:trunk[4790] --- .../lifecyclevalidatorhelper.class.inc.php | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/datamodels/2.x/itop-portal-base/portal/src/helpers/lifecyclevalidatorhelper.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/helpers/lifecyclevalidatorhelper.class.inc.php index 33bd57fbc8..65b8952aa1 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/helpers/lifecyclevalidatorhelper.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/helpers/lifecyclevalidatorhelper.class.inc.php @@ -23,6 +23,7 @@ use \Exception; use \DOMNodeList; use \DOMFormatException; use \utils; +use \UserRights; use \ProfilesConfig; use \MetaModel; use \DBSearch; @@ -125,8 +126,8 @@ class LifecycleValidatorHelper $sFilePath = $this->sCachePath . $this->sFilename; // Creating file if not existing - // Note : This is a temporary cache system, it should soon evolve to a cache provider (fs, apc, memcache, ...) - if (1 || !file_exists($sFilePath)) + // Note: This is a temporary cache system, it should soon evolve to a cache provider (fs, apc, memcache, ...) + if (!file_exists($sFilePath)) { // - Build php array from xml $aProfiles = array(); @@ -213,6 +214,8 @@ class LifecycleValidatorHelper // Filling the array with missing classes from MetaModel, so we can have an inheritance principle on the stimuli // For each class explicitly given in the stimuli, we check if its child classes were also in the stimuli : // If not, we add them + // + // Note: Classes / Stimuli not in the matrix are implicitly ALLOWED. That can happen by omitting the in a foreach ($aProfileClasses as $sProfileClass) { foreach (MetaModel::EnumChildClasses($sProfileClass) as $sChildClass) @@ -293,7 +296,17 @@ class LifecycleValidatorHelper // Retrieving profile stimuli $sLifecycleValuesClass = $this->sGeneratedClass; $aProfileMatrix = $sLifecycleValuesClass::GetProfileStimuli($iProfileId, $sClass); - $aStimuli = array_merge_recursive($aStimuli, $aProfileMatrix); + + // If the profile / class tuple is not present (null), it means that all stimuli are allowed + if($aProfileMatrix === null) + { + $aImplicitStimuli = array_keys(MetaModel::EnumStimuli($sClass)); + $aStimuli = array_merge_recursive($aStimuli, $aImplicitStimuli); + } + else + { + $aStimuli = array_merge_recursive($aStimuli, $aProfileMatrix); + } } return $aStimuli; @@ -374,7 +387,7 @@ class $sClassName */ public static function GetProfileStimuli(\$iProfileId, \$sClass) { - \$aStimuli = array(); + \$aStimuli = null; \$sLifecycleKey = \$iProfileId.'_'.\$sClass; if (isset(self::\$aPROFILES[\$sLifecycleKey]))