2154 - preserve "var" in conf

- add possibility to inject var using string patterns (ie: `'%env(DB_HOST)?:localhost%`)
 - on WriteToFile, preserve the non interpreted value when the interpreted value is kept the same
 - added unit tests for both behaviours
 - minor bugfix (default value in comment was wrong) and code readability improvements
This commit is contained in:
bruno DA SILVA
2020-01-31 17:21:46 +01:00
parent 78d4c8c7c7
commit 15c9cf926e
5 changed files with 813 additions and 16 deletions

View File

@@ -90,7 +90,16 @@ class Config
protected $m_aWebServiceCategories;
protected $m_aAddons;
/** @var ConfigPlaceholdersResolver */
private $oConfigPlaceholdersResolver;
protected $m_aModuleSettings;
/**
* @var \iTopConfigParser|null
*/
private $oItopConfigParser;
//for each conf entry, whether the non interpreted value can be kept in case is is written back to the disk.
private $m_aCanOverrideSettings;
/**
* New way to store the settings !
@@ -1250,10 +1259,8 @@ class Config
'show_in_conf_sample' => false,
),
);
/**
* @var \iTopConfigParser|null
*/
private $oItopConfigParser;
public function IsProperty($sPropCode)
{
@@ -1283,12 +1290,16 @@ class Config
* @param string $sPropCode
* @param mixed $value
* @param string $sSourceDesc mandatory for variables with show_in_conf_sample=false
* @param bool $bCanOverride whether the written to file value can still be the non evaluated version on must be the literal
*
* @throws \CoreException
*/
public function Set($sPropCode, $value, $sSourceDesc = 'unknown', $bCanOverride = false)
{
$sType = $this->m_aSettings[$sPropCode]['type'];
$value = $this->oConfigPlaceholdersResolver->Resolve($value);
switch ($sType)
{
case 'bool':
@@ -1308,6 +1319,13 @@ class Config
default:
throw new CoreException('Unknown type for setting', array('property' => $sPropCode, 'type' => $sType));
}
if ($this->m_aSettings[$sPropCode]['value'] == $value)
{
//when you set the exact same value than the previous one, then, you still can preserve the non evaluated version and so on preserve vars/jokers.
$bCanOverride = true;
}
$this->m_aSettings[$sPropCode]['value'] = $value;
$this->m_aSettings[$sPropCode]['source_of_value'] = $sSourceDesc;
$this->m_aCanOverrideSettings[$sPropCode] = $bCanOverride;
@@ -1404,6 +1422,8 @@ class Config
*/
public function __construct($sConfigFile = null, $bLoadConfig = true)
{
$this->oConfigPlaceholdersResolver = new ConfigPlaceholdersResolver();
$this->m_sFile = $sConfigFile;
if (is_null($sConfigFile))
{
@@ -2001,16 +2021,7 @@ class Config
if (isset($aSettingInfo['default']))
{
if (isset($this->m_aCanOverrideSettings[$sPropCode]) && $this->m_aCanOverrideSettings[$sPropCode])
{
$aParserValue = $this->oItopConfigParser->GetVarValue('MySettings', $sPropCode);
}
else
{
$aParserValue = array('found' => false);
}
$sComment = self::PrettyVarExport($aParserValue,$aSettingInfo['default'], "\t//\t\t", true);
$sComment = self::PrettyVarExport(null,$aSettingInfo['default'], "\t//\t\t", true);
fwrite($hFile,"\t//\tdefault: {$sComment}\n");
}
@@ -2020,7 +2031,7 @@ class Config
}
else
{
$aParserValue = array('found' => false);
$aParserValue = null;
}
$sSeenAs = self::PrettyVarExport($aParserValue,$aSettingInfo['value'], "\t");
fwrite($hFile, "\t'$sPropCode' => $sSeenAs,\n");
@@ -2266,7 +2277,7 @@ class Config
*/
protected static function PrettyVarExport($aParserValue, $value, $sIndentation, $bForceIndentation = false)
{
if ($aParserValue['found'])
if (is_array($aParserValue) && $aParserValue['found'])
{
return $aParserValue['value'];
}
@@ -2290,3 +2301,107 @@ class Config
}
}
class ConfigPlaceholdersResolver
{
/**
* @var null|array
*/
private $aEnv;
/**
* @var null|array
*/
private $aServer;
public function __construct($aEnv = null, $aServer = null)
{
$this->aEnv = $aEnv ?: $_ENV;
$this->aServer = $aServer ?: $_SERVER;
}
public function Resolve($rawValue)
{
if (empty($this->aEnv['ITOP_CONFIG_PLACEHOLDERS']))
{
IssueLog::Trace('ITOP_CONFIG_PLACEHOLDERS disabled, the feature is disabled', self::class, array($rawValue));
return $rawValue;
}
if (is_array($rawValue))
{
$aResolvedRawValue = array();
foreach ($rawValue as $key => $value)
{
$aResolvedRawValue[$key] = $this->Resolve($value);
}
IssueLog::Trace('Resolved array ', self::class, array($aResolvedRawValue));
return $aResolvedRawValue;
}
if (!is_string($rawValue))
{
IssueLog::Trace('Unhandled var type', self::class, array($rawValue));
return $rawValue;
}
$sPattern = '/\%(env|server)\((\w+)\)(?:\?:(\w*))?\%/'; //3 capturing groups, ie `%env(HTTP_PORT)?:8080%` produce: `env` `HTTP_PORT` and `8080`.
if (! preg_match_all($sPattern, $rawValue, $aMatchesCollection, PREG_SET_ORDER))
{
IssueLog::Trace("No matching pattern found inside '{$rawValue}'", self::class);
return $rawValue;
}
$sValue = $rawValue;
foreach ($aMatchesCollection as $aMatches)
{
$sWholeMask = $aMatches[0];
$sSource = $aMatches[1];
$sKey = $aMatches[2];
$sDefault = isset($aMatches[3]) ? $aMatches[3] : null;
$sReplacement = $this->Get($sSource, $sKey, $sDefault, $sWholeMask);
$sValue = str_replace($sWholeMask, $sReplacement, $sValue);
}
IssueLog::Trace("replacement done, from '{$rawValue}' to '{$sValue}'", self::class);
return $sValue;
}
private function Get($sSourceName, $sKey, $sDefault, $sWholeMask)
{
if ('env' == $sSourceName)
{
$aSource = $this->aEnv;
}
else if ('server' == $sSourceName)
{
$aSource = $this->aServer;
}
else
{
$sErrorMessage = sprintf('unsupported source name "%s" into "%s"', $sSourceName, $sWholeMask);
IssueLog::Error($sErrorMessage, self::class, array($sSourceName, $sKey, $sDefault, $sWholeMask));
throw new ConfigException($sErrorMessage);
}
if (array_key_exists($sKey, $aSource))
{
return $aSource[$sKey];
}
if (null !== $sDefault)
{
return $sDefault;
}
$sErrorMessage = sprintf('key "%s" not found into "%s" while expanding', $sSourceName, $sWholeMask);
IssueLog::Error($sErrorMessage, self::class, array($sSourceName, $sKey, $sDefault, $sWholeMask));
throw new ConfigException($sErrorMessage);
}
}

View File

@@ -0,0 +1,172 @@
<?php
/**
* Copyright (C) 2010-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with iTop. If not, see <http: *www.gnu.org/licenses/>
*
*/
namespace Combodo\iTop\Test\UnitTest\Core;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use ConfigPlaceholdersResolver;
use PHPUnit\Framework\TestCase;
/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class ConfigPlaceholdersResolverTest extends ItopTestCase
{
protected function setUp()
{
parent::setUp();
require_once (APPROOT.'core/config.class.inc.php');
}
/**
* @dataProvider providerResolve
*/
public function testResolve($aEnv, $aServer, $sValue, $sExpected, $sExpectedExceptionClass = null)
{
if ($sExpectedExceptionClass)
{
$this->expectException($sExpectedExceptionClass);
}
$oConfigPlaceholdersResolver = new ConfigPlaceholdersResolver($aEnv, $aServer);
$sResult = $oConfigPlaceholdersResolver->Resolve($sValue);
$this->assertEquals($sExpected, $sResult);
}
public function providerResolve()
{
$stdObj = (object) array('%env(HTTP_PORT)?:8080%', '%server(toto)?:8080%', '%foo(toto)?:8080%');
return array(
'basic behaviour' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'),
'aServer' => array(),
'sValue' => '%env(HTTP_PORT)%',
'sExpected' => '443',
),
'disabled if no ITOP_CONFIG_PLACEHOLDERS' => array(
'aEnv' => array('HTTP_PORT' => '443'),
'aServer' => array(),
'sValue' => '%env(HTTP_PORT)%',
'sExpected' => '%env(HTTP_PORT)%',
),
'basic with default not used' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'),
'aServer' => array(),
'sValue' => '%env(HTTP_PORT)?:foo%',
'sExpected' => '443',
),
'basic with default used' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, ),
'aServer' => array(),
'sValue' => '%env(HTTP_PORT)?:foo%',
'sExpected' => 'foo',
),
'basic with default used and empty' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, ),
'aServer' => array(),
'sValue' => '%env(HTTP_PORT)?:%',
'sExpected' => '',
),
'mixed with static' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'),
'aServer' => array('toto' => 'tutu'),
'sValue' => 'http://localhost:%env(HTTP_PORT)?:8080%/',
'sExpected' => 'http://localhost:443/',
),
'multiple occurrences' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'),
'aServer' => array('SERVER_NAME' => 'localhost'),
'sValue' => 'http://%server(SERVER_NAME)%:%env(HTTP_PORT)%/',
'sExpected' => 'http://localhost:443/',
),
'array as source' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'),
'aServer' => array('toto' => 'tutu'),
'sValue' => array('http://localhost:%env(HTTP_PORT)?:8080%/', '%foo(HTTP_PORT)?:8080%', '%server(toto)?:8080%'),
'sExpected' => array('http://localhost:443/', '%foo(HTTP_PORT)?:8080%', 'tutu'),
),
'invalid source' => array(
'aEnv' => array('toto' => 'tutu'),
'aServer' => array('HTTP_PORT' => '443'),
'sValue' => '%foo(HTTP_PORT)?:8080%',
'sExpected' => '%foo(HTTP_PORT)?:8080%',
),
'ignored source' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'),
'aServer' => array('toto' => 'tutu'),
'sValue' => $stdObj,
'sExpected' => $stdObj,
),
'env matching port' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'HTTP_PORT' => '443'),
'aServer' => array('toto' => 'tutu'),
'sValue' => '%env(HTTP_PORT)?:8080%',
'sExpected' => '443',
),
'env no matching port with default ' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'foo' => 'bar'),
'aServer' => array('toto' => 'tutu'),
'sValue' => '%env(HTTP_PORT)?:8080%',
'sExpected' => '8080',
),
'env no matching port' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'foo' => 'bar'),
'aServer' => array('toto' => 'tutu'),
'sValue' => '%env(HTTP_PORT)%',
'sExpected' => null,
'sExpectedExceptionClass' => 'ConfigException',
),
'server matching port' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'toto' => 'tutu'),
'aServer' => array('HTTP_PORT' => '443'),
'sValue' => '%server(HTTP_PORT)?:8080%',
'sExpected' => '443',
),
'server no matching port with default ' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'toto' => 'tutu'),
'aServer' => array('foo' => 'bar'),
'sValue' => '%server(HTTP_PORT)?:8080%',
'sExpected' => '8080',
),
'server no matching port' => array(
'aEnv' => array('ITOP_CONFIG_PLACEHOLDERS' => 1, 'toto' => 'tutu'),
'aServer' => array('foo' => 'bar'),
'sValue' => '%server(HTTP_PORT)%',
'sExpected' => null,
'sExpectedExceptionClass' => 'ConfigException',
),
);
}
}

100
test/core/ConfigTest.php Normal file
View File

@@ -0,0 +1,100 @@
<?php
/**
* Copyright (C) 2010-2020 Combodo SARL
*
* This file is part of iTop.
*
* iTop is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* iTop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with iTop. If not, see <http: *www.gnu.org/licenses/>
*
*/
namespace Combodo\iTop\Test\UnitTest\Core;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use Config;
use PHPUnit\Framework\TestCase;
/**
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
* @backupGlobals disabled
*/
class ConfigTest extends ItopTestCase
{
protected function setUp()
{
parent::setUp();
require_once (APPROOT.'core/config.class.inc.php');
}
/**
*
* @dataProvider ProviderPreserveVarOnWriteToFile
*
* @throws \ConfigException
* @throws \CoreException
*
*/
public function testPreserveVarOnWriteToFile($sConfigFile, $sExpectedContains, $aChanges)
{
$sTmpFile = tempnam(sys_get_temp_dir(), "target");
$oConfig = new Config($sConfigFile);
foreach ($aChanges as $key => $val)
{
$oConfig->Set($key, $val);
}
$oConfig->WriteToFile($sTmpFile);
$this->assertFileExists($sTmpFile);
$sFileContent = file_get_contents($sTmpFile);
$this->assertContains($sExpectedContains, $sFileContent);
}
public function ProviderPreserveVarOnWriteToFile()
{
return array(
'preserve var' => array(
'sConfigFile' => __DIR__.'/ConfigTest/config-itop-var.php',
'sExpectedContains' => "'app_root_url' => 'http://' . (isset(\$_SERVER['SERVER_NAME']) ? \$_SERVER['SERVER_NAME'] : 'localhost') . '/itop/iTop/'",
'aChanges' => array(),
),
'preserve joker' => array(
'sConfigFile' => __DIR__.'/ConfigTest/config-itop-joker.php',
'sExpectedContains' => "'app_root_url' => 'http://%server(SERVER_NAME)?:localhost%/itop/iTop/'",
'aChanges' => array(),
),
'preserve set same value' => array(
'sConfigFile' => __DIR__.'/ConfigTest/config-itop-var.php',
'sExpectedContains' => "'app_root_url' => 'http://' . (isset(\$_SERVER['SERVER_NAME']) ? \$_SERVER['SERVER_NAME'] : 'localhost') . '/itop/iTop/'",
'aChanges' => array('app_root_url' => 'http://localhost/itop/iTop/'),
),
'overwrite var' => array(
'sConfigFile' => __DIR__.'/ConfigTest/config-itop-var.php',
'sExpectedContains' => "'app_root_url' => 'foo",
'aChanges' => array('app_root_url' => 'foo'),
),
'overwrite joker' => array(
'sConfigFile' => __DIR__.'/ConfigTest/config-itop-joker.php',
'sExpectedContains' => "'app_root_url' => 'foo",
'aChanges' => array('app_root_url' => 'foo'),
),
);
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
*
* Configuration file, generated for the unit tests
*
*
*
*/
$MySettings = array(
// app_root_url: Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server's name)
// default: ''
'app_root_url' => 'http://%server(SERVER_NAME)?:localhost%/itop/iTop/',
);
/**
*
* Modules specific settings
*
*/
$MyModuleSettings = array(
);
/**
*
* Data model modules to be loaded. Names are specified as relative paths
*
*/
$MyModules = array(
'addons' => array('user rights' => 'addons/userrights/userrightsprofile.class.inc.php'),
);
?>

View File

@@ -0,0 +1,373 @@
<?php
/**
*
* Configuration file, generated for the unit tests
*
*
*
*/
$MySettings = array(
// access_message: Message displayed to the users when there is any access restriction
// default: 'iTop is temporarily frozen, please wait... (the admin team)'
'access_message' => 'iTop is temporarily frozen, please wait... (the admin team)',
// access_mode: Access mode: ACCESS_READONLY = 0, ACCESS_ADMIN_WRITE = 2, ACCESS_FULL = 3
// default: 3
'access_mode' => 3,
'allowed_login_types' => 'form|external|basic',
// apc_cache.enabled: If set, the APC cache is allowed (the PHP extension must also be active)
// default: true
'apc_cache.enabled' => true,
// apc_cache.query_ttl: Time to live set in APC for the prepared queries (seconds - 0 means no timeout)
// default: 3600
'apc_cache.query_ttl' => 3600,
// app_root_url: Root URL used for navigating within the application, or from an email to the application (you can put $SERVER_NAME$ as a placeholder for the server's name)
// default: ''
'app_root_url' => 'http://%server(SERVER_NAME)?:localhost%/itop/iTop/',
// buttons_position: Position of the forms buttons: bottom | top | both
// default: 'both'
'buttons_position' => 'both',
// cas_include_path: The path where to find the phpCAS library
// default: '/usr/share/php'
'cas_include_path' => '/usr/share/php',
// cron_max_execution_time: Duration (seconds) of the page cron.php, must be shorter than php setting max_execution_time and shorter than the web server response timeout
// default: 600
'cron_max_execution_time' => 600,
// csv_file_default_charset: Character set used by default for downloading and uploading data as a CSV file. Warning: it is case sensitive (uppercase is preferable).
// default: 'ISO-8859-1'
'csv_file_default_charset' => 'ISO-8859-1',
'csv_import_charsets' => array (
),
// csv_import_history_display: Display the history tab in the import wizard
// default: false
'csv_import_history_display' => false,
// date_and_time_format: Format for date and time display (per language)
// default: array (
// 'default' =>
// array (
// 'date' => 'Y-m-d',
// 'time' => 'H:i:s',
// 'date_time' => '$date $time',
// ),
// )
'date_and_time_format' => array('default' => array('date' => 'Y-m-d', 'time' => 'H:i:s', 'date_time' => '$date $time')),
'db_host' => '%env(DB_HOST)?:localhost%',
'db_name' => '%env(DB_NAME)?:itop%',
'db_pwd' => '%env(DB_PWD)%',
'db_subname' => '%env(DB_SUBNAME)?:%',
'db_user' => '%env(DB_USER)?:%',
// deadline_format: The format used for displaying "deadline" attributes: any string with the following placeholders: $date$, $difference$
// default: '$difference$'
'deadline_format' => '$difference$',
'default_language' => 'EN US',
// email_asynchronous: If set, the emails are sent off line, which requires cron.php to be activated. Exception: some features like the email test utility will force the serialized mode
// default: false
'email_asynchronous' => false,
// email_default_sender_address: Default address provided in the email from header field.
// default: ''
'email_default_sender_address' => '',
// email_default_sender_label: Default label provided in the email from header field.
// default: ''
'email_default_sender_label' => '',
// email_transport: Mean to send emails: PHPMail (uses the function mail()) or SMTP (implements the client protocol)
// default: 'PHPMail'
'email_transport' => 'PHPMail',
// email_transport_smtp.host: host name or IP address (optional)
// default: 'localhost'
'email_transport_smtp.host' => '%env(SMTP_HOST)?:localhost%',
// email_transport_smtp.password: Authentication password (optional)
// default: ''
'email_transport_smtp.password' => '%env(SMTP_PWD)?:%',
// email_transport_smtp.username: Authentication user (optional)
// default: ''
'email_transport_smtp.username' => '%env(SMTP_USER)?:%',
// email_validation_pattern: Regular expression to validate/detect the format of an eMail address
// default: '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}'
'email_validation_pattern' => '[a-zA-Z0-9._&\'-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z0-9-]{2,}',
'encryption_key' => '8de353e765ce9460e9dd1d45c354a69bb27f6f94f3fb8f9af2c0998ace085400',
'encryption_library' => 'Sodium',
// expression_cache_enabled: If set, DBSearch will use cache for query expression generation
// default: true
'expression_cache_enabled' => true,
'ext_auth_variable' => '$_SERVER[\'REMOTE_USER\']',
'fast_reload_interval' => '60',
// graphviz_path: Path to the Graphviz "dot" executable for graphing objects lifecycle
// default: '/usr/bin/dot'
'graphviz_path' => '/usr/bin/dot',
// high_cardinality_classes: List of classes with high cardinality (Force manual submit of search)
// default: array (
// )
'high_cardinality_classes' => array(),
// inline_image_max_display_width: The maximum width (in pixels) when displaying images inside an HTML formatted attribute. Images will be displayed using this this maximum width.
// default: '250'
'inline_image_max_display_width' => 250,
// inline_image_max_storage_width: The maximum width (in pixels) when uploading images to be used inside an HTML formatted attribute. Images larger than the given size will be downsampled before storing them in the database.
// default: '1600'
'inline_image_max_storage_width' => 1600,
// link_set_attribute_qualifier: Link set from string: attribute qualifier (encloses both the attcode and the value)
// default: '\''
'link_set_attribute_qualifier' => '\'',
// link_set_attribute_separator: Link set from string: attribute separator
// default: ';'
'link_set_attribute_separator' => ';',
// link_set_item_separator: Link set from string: line separator
// default: '|'
'link_set_item_separator' => '|',
// link_set_value_separator: Link set from string: value separator (between the attcode and the value itself
// default: ':'
'link_set_value_separator' => ':',
'log_global' => true,
'log_issue' => true,
// log_level_min: Optional min log level per channel
// default: ''
'log_level_min' => '',
'log_notification' => true,
'log_web_service' => true,
// login_debug: Activate the login FSM debug
// default: false
'login_debug' => false,
// max_combo_length: The maximum number of elements in a drop-down list. If more then an autocomplete will be used
// default: 50
'max_combo_length' => 50,
'max_display_limit' => '15',
// max_linkset_output: Maximum number of items shown when getting a list of related items in an email, using the form $this->some_list$. 0 means no limit.
// default: 100
'max_linkset_output' => 100,
'min_display_limit' => '10',
// online_help: Hyperlink to the online-help web page
// default: 'http://www.combodo.com/itop-help'
'online_help' => 'http://www.combodo.com/itop-help',
// optimize_requests_for_join_count: Optimize request joins to minimize the count (default is true, try to set it to false in case of performance issues)
// default: true
'optimize_requests_for_join_count' => true,
// php_path: Path to the php executable in CLI mode
// default: 'php'
'php_path' => 'php',
// portal_tickets: CSV list of classes supported in the portal
// default: 'UserRequest'
'portal_tickets' => 'UserRequest',
// query_cache_enabled: If set, DBSearch will use cache for query generation
// default: true
'query_cache_enabled' => true,
// search_manual_submit: Force manual submit of search all requests
// default: false
'search_manual_submit' => false,
'secure_connection_required' => false,
// session_name: The name of the cookie used to store the PHP session id
// default: 'iTop'
'session_name' => 'iTop',
// shortcut_actions: Actions that are available as direct buttons next to the "Actions" menu
// default: 'UI:Menu:Modify,UI:Menu:New'
'shortcut_actions' => 'UI:Menu:Modify,UI:Menu:New',
// source_dir: Source directory for the datamodel files. (which gets compiled to env-production).
// default: ''
'source_dir' => 'datamodels/2.x/',
'standard_reload_interval' => '300',
// synchro_trace: Synchronization details: none, display, save (includes 'display')
// default: 'none'
'synchro_trace' => 'none',
// tag_set_item_separator: Tag set from string: tag label separator
// default: '|'
'tag_set_item_separator' => '|',
// timezone: Timezone (reference: http://php.net/manual/en/timezones.php). If empty, it will be left unchanged and MUST be explicitly configured in PHP
// default: 'Europe/Paris'
'timezone' => 'Europe/Paris',
// tracking_level_linked_set_default: Default tracking level if not explicitly set at the attribute level, for AttributeLinkedSet (defaults to NONE in case of a fresh install, LIST otherwise - this to preserve backward compatibility while upgrading from a version older than 2.0.3 - see TRAC #936)
// default: 1
'tracking_level_linked_set_default' => 1,
// url_validation_pattern: Regular expression to validate/detect the format of an URL (URL attributes and Wiki formatting for Text attributes)
// default: '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?'
'url_validation_pattern' => '(https?|ftp)\\://([a-zA-Z0-9+!*(),;?&=\\$_.-]+(\\:[a-zA-Z0-9+!*(),;?&=\\$_.-]+)?@)?([a-zA-Z0-9-.]{3,})(\\:[0-9]{2,5})?(/([a-zA-Z0-9%+\\$_-]\\.?)+)*/?(\\?[a-zA-Z+&\\$_.-][a-zA-Z0-9;:[\\]@&%=+/\\$_.-]*)?(#[a-zA-Z_.-][a-zA-Z0-9+\\$_.-]*)?',
// use_legacy_dbsearch: If set, DBSearch will use legacy SQL query generation
// default: false
'use_legacy_dbsearch' => false,
);
/**
*
* Modules specific settings
*
*/
$MyModuleSettings = array(
'authent-local' => array (
),
'itop-hub-connector' => array (
'url' => 'https://www.integration.francfort.itophub.io',
),
'authent-cas' => array (
'cas_debug' => false,
'cas_host' => '',
'cas_port' => '',
'cas_context' => '',
'cas_version' => '',
),
'authent-ldap' => array (
'host' => 'localhost',
'port' => 389,
'default_user' => '',
'default_pwd' => '',
'base_dn' => 'dc=yourcompany,dc=com',
'user_query' => '(&(uid=%1$s)(inetuserstatus=ACTIVE))',
'options' => array (
17 => 3,
8 => 0,
),
'start_tls' => false,
'debug' => false,
),
'itop-attachments' => array (
'allowed_classes' => array (
0 => 'Ticket',
),
'position' => 'relations',
'preview_max_width' => 290,
),
'itop-backup' => array (
'mysql_bindir' => '',
'week_days' => 'monday, tuesday, wednesday, thursday, friday',
'time' => '23:30',
'retention_count' => 5,
'enabled' => true,
'itop_backup_incident' => '',
),
'itop-fence' => array (
'trusted_ip_list' => array (
),
'malicious_ip_list' => array (
),
'no_answer_http_response_code' => '429',
'checker_to_countermeasure' => array (
0 =>
array (
'checker' => 'Combodo\\iTop\\Fence\\Checker\\LoginFailedListener',
'countermeasure' => 'Combodo\\iTop\\Fence\\Countermeasure\\Slowdown',
'min_level' => 3,
),
1 =>
array (
'checker' => 'Combodo\\iTop\\Fence\\Hybrid\\Recaptcha',
'countermeasure' => 'Combodo\\iTop\\Fence\\Countermeasure\\LoginInvalid',
'max_level' => 0.4,
'login_mode_included' =>
array (
0 => 'form',
),
),
2 =>
array (
'checker' => 'Combodo\\iTop\\Fence\\Hybrid\\Recaptcha',
'countermeasure' => 'Combodo\\iTop\\Fence\\Hybrid\\Captcha',
'min_level' => 0.4,
'max_level' => 0.6,
'login_mode_included' =>
array (
0 => 'form',
),
),
3 =>
array (
'checker' => 'Combodo\\iTop\\Fence\\Checker\\IpRangeChecker',
'countermeasure' => 'Combodo\\iTop\\Fence\\Hybrid\\Captcha',
'max_level' => 1,
'login_mode_included' =>
array (
0 => 'form',
),
),
4 =>
array (
'checker' => 'Combodo\\iTop\\Fence\\Checker\\IpRangeChecker',
'countermeasure' => 'Combodo\\iTop\\Fence\\Countermeasure\\NoAnswerUntil',
'max_level' => 1,
'login_mode_excluded' =>
array (
0 => 'form',
),
),
5 =>
array (
'checker' => 'Combodo\\iTop\\Fence\\Checker\\IpRangeChecker',
'countermeasure' => 'Combodo\\iTop\\Fence\\Countermeasure\\NoAnswerUntil',
'min_level' => 2,
),
),
),
);
/**
*
* Data model modules to be loaded. Names are specified as relative paths
*
*/
$MyModules = array(
'addons' => array('user rights' => 'addons/userrights/userrightsprofile.class.inc.php'),
);
?>