diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 2eb01ac68..7f9c24a0d 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -60,6 +60,8 @@ class Config protected $m_aAddons; protected $m_aDictionaries; + protected $m_aModuleSettings; + protected $m_sDBHost; protected $m_sDBUser; protected $m_sDBPwd; @@ -119,7 +121,6 @@ class Config '../core/event.class.inc.php', '../core/action.class.inc.php', '../core/trigger.class.inc.php', - '../addons/authentication/authent.local.inc.php', ); $this->m_aDataModels = array(); $this->m_aAddons = array( @@ -148,6 +149,9 @@ class Config $this->m_iFastReloadInterval = DEFAULT_FAST_RELOAD_INTERVAL; $this->m_bSecureConnectionRequired = DEFAULT_SECURE_CONNECTION_REQUIRED; $this->m_sDefaultLanguage = 'EN US'; + + $this->m_aModuleSettings = array(); + if ($bLoadConfig) { $this->Load($sConfigFile); @@ -240,6 +244,8 @@ class Config $this->m_iFastReloadInterval = isset($MySettings['fast_reload_interval']) ? trim($MySettings['fast_reload_interval']) : DEFAULT_FAST_RELOAD_INTERVAL; $this->m_bSecureConnectionRequired = isset($MySettings['secure_connection_required']) ? trim($MySettings['secure_connection_required']) : DEFAULT_SECURE_CONNECTION_REQUIRED; + $this->m_aModuleSettings = isset($MyModuleSettings) ? $MyModuleSettings : array(); + $this->m_sDefaultLanguage = isset($MySettings['default_language']) ? trim($MySettings['default_language']) : 'EN US'; } @@ -263,6 +269,20 @@ class Config } } + public function GetModuleSetting($sModule, $sProperty, $defaultvalue = null) + { + if (isset($this->m_aModuleSettings[$sModule][$sProperty])) + { + return $this->m_aModuleSettings[$sModule][$sProperty]; + } + return $defaultvalue; + } + + public function SetModuleSetting($sModule, $sProperty, $value) + { + $this->m_aModuleSettings[$sModule][$sProperty] = $value; + } + public function GetAppModules() { return $this->m_aAppModules; @@ -497,6 +517,20 @@ class Config fwrite($hFile, "\t'secure_connection_required' => ".($this->m_bSecureConnectionRequired ? 'true' : 'false').",\n"); fwrite($hFile, "\t'default_language' => '{$this->m_sDefaultLanguage}',\n"); fwrite($hFile, ");\n"); + + fwrite($hFile, "\n"); + fwrite($hFile, "\$MyModuleSettings = array(\n"); + foreach ($this->m_aModuleSettings as $sModule => $aProperties) + { + fwrite($hFile, "\t'$sModule' => array (\n"); + foreach ($aProperties as $sProperty => $value) + { + $sExport = var_export($value, true); + fwrite($hFile, "\t\t'$sProperty' => $sExport,\n"); + } + fwrite($hFile, "\t),\n"); + } + fwrite($hFile, ");\n"); fwrite($hFile, "\n/**\n"); fwrite($hFile, " *\n"); diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 9eee83caf..81cba9507 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -188,6 +188,8 @@ abstract class MetaModel } } + private static $m_oConfig = null; + private static $m_bTraceQueries = true; private static $m_aQueriesLog = array(); @@ -3110,18 +3112,18 @@ abstract class MetaModel public static function LoadConfig($sConfigFile) { - $oConfig = new Config($sConfigFile); + self::$m_oConfig = new Config($sConfigFile); // Set log ASAP - if ($oConfig->GetLogGlobal()) + if (self::$m_oConfig->GetLogGlobal()) { - if ($oConfig->GetLogIssue()) + if (self::$m_oConfig->GetLogIssue()) { self::$m_bLogIssue = true; IssueLog::Enable('../error.log'); } - self::$m_bLogNotification = $oConfig->GetLogNotification(); - self::$m_bLogWebService = $oConfig->GetLogWebService(); + self::$m_bLogNotification = self::$m_oConfig->GetLogNotification(); + self::$m_bLogWebService = self::$m_oConfig->GetLogWebService(); } else { @@ -3132,35 +3134,35 @@ abstract class MetaModel // Note: load the dictionary as soon as possible, because it might be // needed when some error occur - foreach ($oConfig->GetDictionaries() as $sModule => $sToInclude) + foreach (self::$m_oConfig->GetDictionaries() as $sModule => $sToInclude) { self::Plugin($sConfigFile, 'dictionaries', $sToInclude); } // Set the language... after the dictionaries have been loaded! - Dict::SetDefaultLanguage($oConfig->GetDefaultLanguage()); + Dict::SetDefaultLanguage(self::$m_oConfig->GetDefaultLanguage()); // Romain: this is the only way I've found to cope with the fact that // classes have to be derived from cmdbabstract (to be editable in the UI) require_once('../application/cmdbabstract.class.inc.php'); - foreach ($oConfig->GetAppModules() as $sModule => $sToInclude) + foreach (self::$m_oConfig->GetAppModules() as $sModule => $sToInclude) { self::Plugin($sConfigFile, 'application', $sToInclude); } - foreach ($oConfig->GetDataModels() as $sModule => $sToInclude) + foreach (self::$m_oConfig->GetDataModels() as $sModule => $sToInclude) { self::Plugin($sConfigFile, 'business', $sToInclude); } - foreach ($oConfig->GetAddons() as $sModule => $sToInclude) + foreach (self::$m_oConfig->GetAddons() as $sModule => $sToInclude) { self::Plugin($sConfigFile, 'addons', $sToInclude); } - $sServer = $oConfig->GetDBHost(); - $sUser = $oConfig->GetDBUser(); - $sPwd = $oConfig->GetDBPwd(); - $sSource = $oConfig->GetDBName(); - $sTablePrefix = $oConfig->GetDBSubname(); + $sServer = self::$m_oConfig->GetDBHost(); + $sUser = self::$m_oConfig->GetDBUser(); + $sPwd = self::$m_oConfig->GetDBPwd(); + $sSource = self::$m_oConfig->GetDBName(); + $sTablePrefix = self::$m_oConfig->GetDBSubname(); // The include have been included, let's browse the existing classes and // develop some data based on the proposed model @@ -3172,6 +3174,11 @@ abstract class MetaModel CMDBSource::Init($sServer, $sUser, $sPwd); // do not select the DB (could not exist) } + public static function GetModuleSetting($sModule, $sProperty, $defaultvalue = null) + { + return self::$m_oConfig->GetModuleSetting($sModule, $sProperty, $defaultvalue); + } + protected static $m_aPlugins = array(); public static function RegisterPlugin($sType, $sName, $aInitCallSpec = array()) { diff --git a/modules/authent-ldap/en.dict.authent-ldap.php b/modules/authent-ldap/en.dict.authent-ldap.php new file mode 100644 index 000000000..0d2a0fc4c --- /dev/null +++ b/modules/authent-ldap/en.dict.authent-ldap.php @@ -0,0 +1,37 @@ + + * @author Romain Quetiez + * @author Denis Flaven + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL + */ + +// Dictionnay conventions +// Class: +// Class:+ +// Class:/Attribute: +// Class:/Attribute:+ +// Class:/Attribute:/Value: +// Class:/Attribute:/Value:+ +// Class:/Stimulus: +// Class:/Stimulus:+ + + +?> diff --git a/addons/authentication/authent.nullpassword.inc.php b/modules/authent-ldap/model.authent-ldap.php similarity index 74% rename from addons/authentication/authent.nullpassword.inc.php rename to modules/authent-ldap/model.authent-ldap.php index a96f16db7..af95f3a12 100644 --- a/addons/authentication/authent.nullpassword.inc.php +++ b/modules/authent-ldap/model.authent-ldap.php @@ -15,7 +15,7 @@ // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /** - * Authent Null Password + * Authent LDAP * User authentication Module, no password at all! * * @author Erwan Taloc @@ -25,7 +25,7 @@ */ -class UserNullPassword extends User +class UserLDAP extends User { public static function Init() { @@ -36,7 +36,6 @@ class UserNullPassword extends User "name_attcode" => "login", "state_attcode" => "", "reconc_keys" => array(), - //"db_table" => "aaaaaaanullpassword", "db_table" => "", "db_key_field" => "id", "db_finalclass_field" => "", @@ -55,12 +54,29 @@ class UserNullPassword extends User public function CheckCredentials($sPassword) { - return true; + $aLDAPConfig['host'] = MetaModel::GetModuleSetting('authent-ldap', 'host', 'localhost'); + $aLDAPConfig['port'] = MetaModel::GetModuleSetting('authent-ldap', 'port', 389); + $aLDAPConfig['basedn'] = MetaModel::GetModuleSetting('authent-ldap', 'basedn', 'dc=net'); + + $ds = @ldap_connect($aLDAPConfig['host'], $aLDAPConfig['port']); + ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); + ldap_set_option($ds, LDAP_OPT_REFERRALS, 0); + + $sDN = "uid=".$this->Get('login').",ou=people,".$aLDAPConfig['basedn']; + + if ($bind = @ldap_bind($ds, $sDN, $sPassword)) + { + return true; + } + else + { + return false; + } } public function TrustWebServerContext() { - return true; + return false; } public function CanChangePassword() @@ -70,7 +86,7 @@ class UserNullPassword extends User public function ChangePassword($sOldPassword, $sNewPassword) { - return true; + return false; } } diff --git a/modules/authent-ldap/module.authent-ldap.php b/modules/authent-ldap/module.authent-ldap.php new file mode 100644 index 000000000..f858030ad --- /dev/null +++ b/modules/authent-ldap/module.authent-ldap.php @@ -0,0 +1,50 @@ + 'User authentication based on LDAP', + 'category' => 'authentication', + + // Setup + // + 'dependencies' => array( + ), + 'mandatory' => false, + 'visible' => true, + + // Components + // + 'datamodel' => array( + 'model.authent-ldap.php', + ), + 'dictionary' => array( + 'en.dict.authent-ldap.php', + ), + 'data.struct' => array( + //'data.struct.authent-ldap.xml', + ), + 'data.sample' => array( + //'data.sample.authent-ldap.xml', + ), + + // Documentation + // + 'doc.manual_setup' => '', + 'doc.more_information' => '', + + // Default settings + // + 'settings' => array( + 'host' => '192.168.10.164', + 'port' => 389, + 'basedn' => 'dc=leconcorde,dc=net', + ), + ) +); + +?> diff --git a/modules/authent-local/en.dict.authent-local.php b/modules/authent-local/en.dict.authent-local.php new file mode 100644 index 000000000..0d2a0fc4c --- /dev/null +++ b/modules/authent-local/en.dict.authent-local.php @@ -0,0 +1,37 @@ + + * @author Romain Quetiez + * @author Denis Flaven + * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL + */ + +// Dictionnay conventions +// Class: +// Class:+ +// Class:/Attribute: +// Class:/Attribute:+ +// Class:/Attribute:/Value: +// Class:/Attribute:/Value:+ +// Class:/Stimulus: +// Class:/Stimulus:+ + + +?> diff --git a/addons/authentication/authent.local.inc.php b/modules/authent-local/model.authent-local.php similarity index 100% rename from addons/authentication/authent.local.inc.php rename to modules/authent-local/model.authent-local.php diff --git a/modules/authent-local/module.authent-local.php b/modules/authent-local/module.authent-local.php new file mode 100644 index 000000000..082eb8bb5 --- /dev/null +++ b/modules/authent-local/module.authent-local.php @@ -0,0 +1,47 @@ + 'User authentication based on the local DB', + 'category' => 'authentication', + + // Setup + // + 'dependencies' => array( + ), + 'mandatory' => true, + 'visible' => true, + + // Components + // + 'datamodel' => array( + 'model.authent-local.php', + ), + 'dictionary' => array( + 'en.dict.authent-local.php', + ), + 'data.struct' => array( + //'data.struct.authent-local.xml', + ), + 'data.sample' => array( + //'data.sample.authent-local.xml', + ), + + // Documentation + // + 'doc.manual_setup' => '', + 'doc.more_information' => '', + + // Default settings + // + 'settings' => array( + ), + ) +); + +?> diff --git a/modules/itop-basic-1.0.0/disabled.module.itop-basic.php b/modules/itop-basic-1.0.0/disabled.module.itop-basic.php index 8804e299b..3aef0bb7e 100644 --- a/modules/itop-basic-1.0.0/disabled.module.itop-basic.php +++ b/modules/itop-basic-1.0.0/disabled.module.itop-basic.php @@ -8,6 +8,7 @@ SetupWebPage::AddModule( // Identification // 'label' => 'iTop Basic Model', + 'category' => 'business', // Setup // @@ -35,6 +36,11 @@ SetupWebPage::AddModule( // 'doc.manual_setup' => '/doc/xxx/yyy.htm', 'doc.more_information' => '/doc/xxx/yyy.htm', + + // Default settings + // + 'settings' => array( + ), ) ); diff --git a/modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php b/modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php index 873d41ae9..f440ecfc2 100644 --- a/modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php +++ b/modules/itop-change-mgmt-1.0.0/module.itop-change-mgmt.php @@ -8,6 +8,7 @@ SetupWebPage::AddModule( // Identification // 'label' => 'Change Management', + 'category' => 'business', // Setup // @@ -38,6 +39,11 @@ SetupWebPage::AddModule( // 'doc.manual_setup' => '', 'doc.more_information' => '/doc/itop-documentation.htm#ChangeMgmt', + + // Default settings + // + 'settings' => array( + ), ) ); diff --git a/modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php b/modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php index 51f90dc91..26932a6e2 100644 --- a/modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php +++ b/modules/itop-config-mgmt-1.0.0/module.itop-config-mgmt.php @@ -8,6 +8,7 @@ SetupWebPage::AddModule( // Identification // 'label' => 'Configuration Management (CMDB)', + 'category' => 'business', // Setup // @@ -49,6 +50,11 @@ SetupWebPage::AddModule( // 'doc.manual_setup' => '', // No manual installation required 'doc.more_information' => '/doc/itop-documentation.htm#ConfigMgmt', + + // Default settings + // + 'settings' => array( + ), ) ); diff --git a/modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php b/modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php index 0b8c78dce..589e9070f 100644 --- a/modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php +++ b/modules/itop-incident-mgmt-1.0.0/module.itop-incident-mgmt.php @@ -8,6 +8,7 @@ SetupWebPage::AddModule( // Identification // 'label' => 'Incident Management', + 'category' => 'business', // Setup // @@ -39,6 +40,11 @@ SetupWebPage::AddModule( // 'doc.manual_setup' => '', 'doc.more_information' => '/doc/itop-documentation.htm#IncidentMgmt', + + // Default settings + // + 'settings' => array( + ), ) ); diff --git a/modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php b/modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php index adb4a7628..3414805fa 100644 --- a/modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php +++ b/modules/itop-knownerror-mgmt-1.0.0/module.itop-knownerror-mgmt.php @@ -8,6 +8,7 @@ SetupWebPage::AddModule( // Identification // 'label' => 'Known Errors Database', + 'category' => 'business', // Setup // @@ -38,6 +39,11 @@ SetupWebPage::AddModule( // 'doc.manual_setup' => '', // No manual installation instructions 'doc.more_information' => '/doc/itop-documentation.htm#KnownErrorsDB', + + // Default settings + // + 'settings' => array( + ), ) ); diff --git a/modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php b/modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php index 372fb18ba..9a4cce9fd 100644 --- a/modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php +++ b/modules/itop-problem-mgmt-1.0.0/module.itop-problem-mgmt.php @@ -8,6 +8,7 @@ SetupWebPage::AddModule( // Identification // 'label' => 'Problem Management', + 'category' => 'business', // Setup // @@ -38,6 +39,11 @@ SetupWebPage::AddModule( // 'doc.manual_setup' => '', // No manual installation instructions 'doc.more_information' => '/doc/itop-documentation.htm#ProblemMgmt', + + // Default settings + // + 'settings' => array( + ), ) ); diff --git a/modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php b/modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php index 15cd7d8e5..76033b459 100644 --- a/modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php +++ b/modules/itop-request-mgmt-1.0.0/module.itop-request-mgmt.php @@ -8,6 +8,7 @@ SetupWebPage::AddModule( // Identification // 'label' => 'User request management (Service Desk)', + 'category' => 'business', // Setup // @@ -38,6 +39,11 @@ SetupWebPage::AddModule( // 'doc.manual_setup' => '', 'doc.more_information' => '/doc/itop-documentation.htm#RequestMgmt', + + // Default settings + // + 'settings' => array( + ), ) ); diff --git a/modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php b/modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php index 7c8af94d3..42d17fd64 100644 --- a/modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php +++ b/modules/itop-service-mgmt-1.0.0/module.itop-service-mgmt.php @@ -8,6 +8,7 @@ SetupWebPage::AddModule( // Identification // 'label' => 'Service Management (services, SLAs, contracts)', + 'category' => 'business', // Setup // @@ -43,6 +44,11 @@ SetupWebPage::AddModule( // 'doc.manual_setup' => '', // No manual installation instructions 'doc.more_information' => '/doc/itop-documentation.htm#ServiceMgmt', + + // Default settings + // + 'settings' => array( + ), ) ); diff --git a/modules/itop-tickets-1.0.0/module.itop-tickets.php b/modules/itop-tickets-1.0.0/module.itop-tickets.php index fea36e751..9f7f8639a 100644 --- a/modules/itop-tickets-1.0.0/module.itop-tickets.php +++ b/modules/itop-tickets-1.0.0/module.itop-tickets.php @@ -8,6 +8,7 @@ SetupWebPage::AddModule( // Identification // 'label' => 'Tickets - prerequisite for ticket modules', + 'category' => 'business', // Setup // @@ -35,6 +36,11 @@ SetupWebPage::AddModule( // 'doc.manual_setup' => '', 'doc.more_information' => '', + + // Default settings + // + 'settings' => array( + ), ) ); diff --git a/setup/index.php b/setup/index.php index 5495bb442..0c903b402 100644 --- a/setup/index.php +++ b/setup/index.php @@ -568,6 +568,10 @@ function BuildConfig(SetupWebpage $oP, Config &$oConfig, $aParamValues) $oP->log('Installed iTop module: '. $sModuleId); $aDataModels = array_unique(array_merge($aDataModels, $aAvailableModules[$sModuleId]['datamodel'])); $sDictionaries = array_unique(array_merge($sDictionaries, $aAvailableModules[$sModuleId]['dictionary'])); + foreach($aAvailableModules[$sModuleId]['settings'] as $sProperty => $value) + { + $oConfig->SetModuleSetting($sModuleId, $sProperty, $value); + } } $oConfig->SetAddOns($aAddOns); $oConfig->SetAppModules($aAppModules); @@ -790,7 +794,13 @@ function ModulesSelection(SetupWebPage $oP, $aParamValues, $iCurrentStep, $oConf $sClass = ($aModule['mandatory']) ? 'class="read-only"' : ''; $sChecked = ($aModule['mandatory'] || in_array($sModuleId, $aSelectedModules) ) ? 'checked' : ''; $sMoreInfo = (!empty($aModule['doc.more_information'])) ? "more info": ''; - if ($aModule['visible']) + if ($aModule['category'] == 'authentication') + { + // For now authentication modules are always on and hidden + $oP->add("\n"); + $index++; + } + elseif ($aModule['visible']) { $oP->add("

$sMoreInfo

\n"); $index++; @@ -799,6 +809,7 @@ function ModulesSelection(SetupWebPage $oP, $aParamValues, $iCurrentStep, $oConf { // For now hidden modules are always on ! $oP->add("\n"); + $index++; } } $oP->add("");