mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
#972 Incomprehensible error message during setup, with a sample extension provided by Combodo! (empty user rights tag) -This fix improves a lot, but the final fix should be to compile user rights in a separate directory. To be further discussed.
SVN:trunk[3374]
This commit is contained in:
@@ -4922,7 +4922,15 @@ abstract class MetaModel
|
||||
if (!file_exists($sFile))
|
||||
{
|
||||
$sConfigFile = self::$m_oConfig->GetLoadedFile();
|
||||
throw new CoreException('Wrong filename in configuration file', array('file' => $sConfigFile, 'module' => $sModuleType, 'filename' => $sFile));
|
||||
if (strlen($sConfigFile) > 0)
|
||||
{
|
||||
throw new CoreException('Include: wrong file name in configuration file', array('config file' => $sConfigFile, 'section' => $sModuleType, 'filename' => $sFile));
|
||||
}
|
||||
else
|
||||
{
|
||||
// The configuration is in memory only
|
||||
throw new CoreException('Include: wrong file name in configuration file (in memory)', array('section' => $sModuleType, 'filename' => $sFile));
|
||||
}
|
||||
}
|
||||
|
||||
// Note: We do not expect the modules to output characters while loading them.
|
||||
|
||||
@@ -116,14 +116,27 @@ class MFCompiler
|
||||
}
|
||||
|
||||
// Determine the target module (exactly one!) for USER RIGHTS
|
||||
//
|
||||
// This used to be based solely on the module which created the user_rights node first
|
||||
// Unfortunately, our sample extension was delivered with the xml structure, resulting in the new module to be the recipient of the compilation
|
||||
// Then model.itop-profiles-itil would not exist... resulting in an error after the compilation (and the actual product of the compiler would never be included
|
||||
// The bullet proof implementation would be to compile in a separate directory as it has been done with the dictionaries... that's another story
|
||||
$aModules = $this->oFactory->GetLoadedModules();
|
||||
$sUserRightsModule = '';
|
||||
$oUserRightsNode = $this->oFactory->GetNodes('user_rights')->item(0);
|
||||
if ($oUserRightsNode)
|
||||
foreach($aModules as $foo => $oModule)
|
||||
{
|
||||
$sUserRightsModule = $oUserRightsNode->getAttribute('_created_in');
|
||||
$this->Log("User Rights module found: $sUserRightsModule");
|
||||
if ($oModule->GetName() == 'itop-profiles-itil')
|
||||
{
|
||||
$sUserRightsModule = 'itop-profiles-itil';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$oUserRightsNode = $this->oFactory->GetNodes('user_rights')->item(0);
|
||||
if ($oUserRightsNode && ($sUserRightsModule == ''))
|
||||
{
|
||||
// Legacy algorithm (itop <= 2.0.3)
|
||||
$sUserRightsModule = $oUserRightsNode->getAttribute('_created_in');
|
||||
}
|
||||
$this->Log("User Rights module found: '$sUserRightsModule'");
|
||||
|
||||
// List root classes
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user