diff --git a/core/cmdbchangeop.class.inc.php b/core/cmdbchangeop.class.inc.php
index 6aaee08a2..3c5e814aa 100644
--- a/core/cmdbchangeop.class.inc.php
+++ b/core/cmdbchangeop.class.inc.php
@@ -78,7 +78,7 @@ class CMDBChangeOp extends DBObject implements iCMDBChangeOp
}
/**
- * Describe (as a text string) the modifications corresponding to this change
+ * @inheritDoc
*/
public function GetDescription()
{
diff --git a/core/metamodel.class.php b/core/metamodel.class.php
index f5d2672cc..c6a58a8d0 100644
--- a/core/metamodel.class.php
+++ b/core/metamodel.class.php
@@ -7308,7 +7308,7 @@ abstract class MetaModel
}
IssueLog::Debug(
'Invalid placeholder in notification, no replacement will occur!',
- LogChannels::NOTIFICATION,
+ LogChannels::NOTIFICATIONS,
$aContext
);
}
@@ -7333,7 +7333,7 @@ abstract class MetaModel
catch (Exception $e) {
IssueLog::Debug(
'Invalid placeholder in notification, no replacement will occur !',
- LogChannels::NOTIFICATION,
+ LogChannels::NOTIFICATIONS,
[
'placeholder' => $sPlaceholderAttCode,
'replace' => $replace,
diff --git a/setup/permissions-test-folder/.htaccess b/setup/permissions-test-folder/.htaccess
new file mode 100644
index 000000000..782472c78
--- /dev/null
+++ b/setup/permissions-test-folder/.htaccess
@@ -0,0 +1,13 @@
+# Apache 2.4
+
+Require all denied
+
+
+# Apache 2.2
+
+deny from all
+Satisfy All
+
+
+# Apache 2.2 and 2.4
+IndexIgnore *
diff --git a/setup/permissions-test-folder/permissions-test-subfolder/permissions-test-file b/setup/permissions-test-folder/permissions-test-subfolder/permissions-test-file
new file mode 100644
index 000000000..e69de29bb
diff --git a/setup/permissions-test-folder/web.config b/setup/permissions-test-folder/web.config
new file mode 100644
index 000000000..58c9c3ac3
--- /dev/null
+++ b/setup/permissions-test-folder/web.config
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/setup/setup.js b/setup/setup.js
index bdec79eea..0556d9c71 100644
--- a/setup/setup.js
+++ b/setup/setup.js
@@ -53,4 +53,17 @@ function ExecuteStep(sStep)
} );
}
+function CheckDirectoryConfFilesPermissions(sWikiVersion){
+ $.ajax('permissions-test-folder/permissions-test-subfolder/permissions-test-file',
+ {
+ statusCode: {
+ 200: function() {
+ $('#details').prepend('
Security issue: iTop is bundled with directory-level configuration files. You must check that those files will be read by your web server (eg. ' +
+ 'AllowOverride directive should be set to All for Apache HTTP Server) see documentation.
');
+ $(' and 1 Security issue').insertBefore('h2.message button:first');
+ }
+ }
+ });
+}
+
CombodoTooltip.InitAllNonInstantiatedTooltips();
\ No newline at end of file
diff --git a/setup/wizardsteps.class.inc.php b/setup/wizardsteps.class.inc.php
index dc5e73b9a..e3e277d7c 100644
--- a/setup/wizardsteps.class.inc.php
+++ b/setup/wizardsteps.class.inc.php
@@ -165,6 +165,7 @@ HTML
$oPage->p('Sorry, the installation cannot continue. Please fix the errors and reload this page to launch the installation again.');
$oPage->p('');
}
+ $oPage->add_ready_script('CheckDirectoryConfFilesPermissions("'.utils::GetItopVersionWikiSyntax().'")');
}
public function CanMoveForward()
diff --git a/sources/Application/UI/Base/Component/FieldBadge/FieldBadgeUIBlockFactory.php b/sources/Application/UI/Base/Component/FieldBadge/FieldBadgeUIBlockFactory.php
index 353254153..e8cd1c94e 100644
--- a/sources/Application/UI/Base/Component/FieldBadge/FieldBadgeUIBlockFactory.php
+++ b/sources/Application/UI/Base/Component/FieldBadge/FieldBadgeUIBlockFactory.php
@@ -10,6 +10,7 @@ namespace Combodo\iTop\Application\UI\Base\Component\FieldBadge;
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
use ormStyle;
+use utils;
/**
* Class FieldBadgeUIBlockFactory
@@ -36,6 +37,10 @@ class FieldBadgeUIBlockFactory extends AbstractUIBlockFactory
{
$oBadge = null;
$sHtml = '';
+
+ // N°5318 - Sanitize value manually as this UIBlock is not using a proper TWIG template 😥
+ $sValueForHtml = utils::EscapeHtml($sValue);
+
if ($oStyle) {
$sStyleClass = $oStyle->GetStyleClass();
$sPrimaryColor = $oStyle->GetMainColor();
@@ -47,12 +52,12 @@ class FieldBadgeUIBlockFactory extends AbstractUIBlockFactory
if (!is_null($sDecorationClasses) && !empty($sDecorationClasses)) {
$sHtml .= "";
}
- $sHtml .= "$sValue";
+ $sHtml .= "$sValueForHtml";
}
}
if (!$oBadge) {
$oBadge = new FieldBadge();
- $sHtml .= "$sValue";
+ $sHtml .= "$sValueForHtml";
}
$oBadge->AddHtml($sHtml);
return $oBadge;
diff --git a/test/application/privUITransactionFileTest.php b/test/application/privUITransactionFileTest.php
index f7960cbe6..cbdf782b2 100644
--- a/test/application/privUITransactionFileTest.php
+++ b/test/application/privUITransactionFileTest.php
@@ -26,6 +26,7 @@ use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
*
* @covers utils
* @group sampleDataNeeded
+ * @group defaultProfiles
*/
class privUITransactionFileTest extends ItopDataTestCase
{
diff --git a/test/core/CMDBSource/TransactionsTest.php b/test/core/CMDBSource/TransactionsTest.php
index e7c4a11e1..00f9872d8 100644
--- a/test/core/CMDBSource/TransactionsTest.php
+++ b/test/core/CMDBSource/TransactionsTest.php
@@ -18,6 +18,7 @@ use MetaModel;
* @backupGlobals disabled
*
* @group itopRequestMgmt
+ * @group specificOrgInSampleData
* Class TransactionsTest
*
* @package Combodo\iTop\Test\UnitTest\Core
@@ -248,4 +249,4 @@ class TransactionsTest extends ItopTestCase
"History 13" => ['iFailAt' => 15, 'bIsModified' => true],
];
}
-}
\ No newline at end of file
+}
diff --git a/test/core/DBSearchTest.php b/test/core/DBSearchTest.php
index 80faea0c8..b7c310649 100644
--- a/test/core/DBSearchTest.php
+++ b/test/core/DBSearchTest.php
@@ -527,6 +527,7 @@ class DBSearchTest extends ItopDataTestCase
/**
* @dataProvider GetFirstResultProvider
+ * @group specificOrgInSampleData
*
* @param string $sOql query to test
* @param bool $bMustHaveOneResultMax arg passed to the tested function
diff --git a/test/core/GetSelectFilterTest.php b/test/core/GetSelectFilterTest.php
index 449d53c47..a3db7e145 100644
--- a/test/core/GetSelectFilterTest.php
+++ b/test/core/GetSelectFilterTest.php
@@ -12,8 +12,9 @@ use utils;
/**
- * @group getSelectFilterTest
+ * @group getSelectFilterTest
* @group sampleDataNeeded
+ * @group specificOrgInSampleData
* Class GetSelectFilterTest
*
* @runTestsInSeparateProcesses
@@ -35,9 +36,9 @@ class GetSelectFilterTest extends ItopDataTestCase
$oRestProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'REST Services User'), true);
$oAdminProfile = MetaModel::GetObjectFromOQL("SELECT URP_Profiles WHERE name = :name", array('name' => 'Administrator'), true);
-
+
$this->sLogin = "getselectfilter-user-" . date('dmYHis');
-
+
// Ensure that we have at least one administrator account
if (is_object($oRestProfile) && is_object($oAdminProfile))
{
@@ -45,7 +46,7 @@ class GetSelectFilterTest extends ItopDataTestCase
$this->AddProfileToUser($this->oUser, $oAdminProfile->GetKey());
}
}
-
+
public function testGetSelectFilter()
{
$oUserRights = new UserRightsProfile();
@@ -64,9 +65,9 @@ class GetSelectFilterTest extends ItopDataTestCase
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Default behavior: Administrators, Administrator profile and URP_UserProfile related to administrators are visible
// via GetSelectFilter
-
+
$oConfig->Set('security.hide_administrators', false);
-
+
$oFilterProfiles = $oUserRights->GetSelectFilter($this->oUser, 'URP_Profiles');
if ($oFilterProfiles === true)
{
@@ -83,7 +84,7 @@ class GetSelectFilterTest extends ItopDataTestCase
}
}
$this->assertEquals($bAdminProfileFound, true);
-
+
foreach($aUserLocalAncestors as $sUserClass)
{
$bAdminUserFound = false;
@@ -103,7 +104,7 @@ class GetSelectFilterTest extends ItopDataTestCase
}
$this->assertEquals($bAdminUserFound, true);
}
-
+
$oFilterLnkProfiles = $oUserRights->GetSelectFilter($this->oUser, 'URP_UserProfile');
if ($oFilterLnkProfiles === true)
{
@@ -160,6 +161,6 @@ class GetSelectFilterTest extends ItopDataTestCase
$this->assertNotEquals($oLnk->Get('userid'), $this->oUser->GetKey());
$this->assertNotEquals($oLnk->Get('profileid'), 1);
}
-
+
}
-}
\ No newline at end of file
+}
diff --git a/test/core/OQLParserTest.php b/test/core/OQLParserTest.php
index afeddc664..63cd2c626 100644
--- a/test/core/OQLParserTest.php
+++ b/test/core/OQLParserTest.php
@@ -29,6 +29,7 @@ class OQLParserTest extends ItopDataTestCase
* @group iTopChangeMgt
* @group itopConfigMgmt
* @group itopRequestMgmt
+ * @group specificOrgInSampleData
* @dataProvider NestedQueryProvider
*
* @param $sQuery
diff --git a/test/core/UserRightsTest.php b/test/core/UserRightsTest.php
index 0c54ebf8f..c3043d85e 100644
--- a/test/core/UserRightsTest.php
+++ b/test/core/UserRightsTest.php
@@ -40,6 +40,7 @@ use utils;
/**
* @group itopRequestMgmt
* @group userRights
+ * @group defaultProfiles
*
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
@@ -486,7 +487,7 @@ class UserRightsTest extends ItopDataTestCase
// logout
$_SESSION = [];
}
-
+
public function NonAdminCanListOwnProfilesProvider(): array
{
return [
@@ -495,7 +496,7 @@ class UserRightsTest extends ItopDataTestCase
];
}
/**
- *@dataProvider NonAdminCannotListAdminProfilesProvider
+ *@dataProvider NonAdminCannotListAdminProfilesProvider
*/
public function testNonAdminCannotListAdminProfiles($bHideAdministrators, $iExpectedCount)
{
@@ -518,7 +519,7 @@ class UserRightsTest extends ItopDataTestCase
// logout
$_SESSION = [];
}
-
+
public function NonAdminCannotListAdminProfilesProvider(): array
{
return [
diff --git a/test/integration/iTopModulesPhpVersionChecklistTest.php b/test/integration/iTopModulesPhpVersionChecklistTest.php
index 5ae32a44e..1bcb679f3 100644
--- a/test/integration/iTopModulesPhpVersionChecklistTest.php
+++ b/test/integration/iTopModulesPhpVersionChecklistTest.php
@@ -21,8 +21,6 @@ use utils;
/**
- * @group itop-community
- *
* @package Combodo\iTop\Test\UnitTest\Setup
*/
class iTopModulesPhpVersionIntegrationTest extends ItopTestCase {
@@ -48,13 +46,18 @@ class iTopModulesPhpVersionIntegrationTest extends ItopTestCase {
}
/**
- * Verify if the datamodel.*.xml files refer to the current itop version
+ * Verify if `module.*.php` files contained in `datamodels/1.x` or `datamodels/2.x` refers to the current itop version
* This is an integration test
*
+ * As ess and pro targets are copying modules into datamodels/2.x this test can only be run on a community target !
+ *
+ * @group itop-community
* @group skipPostBuild
+ *
* @uses utils::GetItopMinorVersion()
*
* @since 2.7.7 3.0.1 3.1.0 N°4714 uses new {@link ITOP_CORE_VERSION} constant
+ * @since 3.0.3 3.1.0 move itop-community group in this method
*/
public function testITopModulesPhpVersion(): void {
if (is_dir(APPROOT.'datamodels/2.x')) {
diff --git a/test/integration/iTopModulesXmlVersionChecklistTest.php b/test/integration/iTopModulesXmlVersionChecklistTest.php
index 895370a43..2d1ce67f9 100644
--- a/test/integration/iTopModulesXmlVersionChecklistTest.php
+++ b/test/integration/iTopModulesXmlVersionChecklistTest.php
@@ -21,8 +21,6 @@ use iTopDesignFormat;
/**
- * @group itop-community
- *
* @covers iTopDesignFormat
*
* @package Combodo\iTop\Test\UnitTest\Setup
@@ -38,12 +36,17 @@ class iTopModulesXmlVersionIntegrationTest extends ItopTestCase
/**
- * Verify if the datamodel.*.xml files refer to the latest version of the design
+ * Verify if the `datamodels/2.x/datamodel.*.xml` files refer to the latest version of the design
* This is an integration test
*
+ * As ess and pro targets are copying modules into datamodels/2.x this test can only be run on a community target !
+ *
+ * @group itop-community
* @group skipPostBuild
*
* @dataProvider DatamodelItopXmlVersionProvider
+ *
+ * @since 3.0.3 3.1.0 move itop-community group in this method
*/
public function testDatamodelItopXmlVersion($sXmlFile)
{
diff --git a/test/integration/iTopXmlVersionChecklistTest.php b/test/integration/iTopXmlVersionChecklistTest.php
index d06c1fbf3..6a624a2c3 100644
--- a/test/integration/iTopXmlVersionChecklistTest.php
+++ b/test/integration/iTopXmlVersionChecklistTest.php
@@ -16,18 +16,9 @@
namespace Combodo\iTop\Test\UnitTest\Integration;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
-use iTopDesignFormat;
/**
- *
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- * @backupGlobals disabled
- * @group itop-community
- *
- * @covers iTopDesignFormat
- *
* @package Combodo\iTop\Test\UnitTest\Setup
*/
class iTopXmlVersionIntegrationTest extends ItopTestCase
diff --git a/test/synchro/DataSynchroTest.php b/test/synchro/DataSynchroTest.php
index c3dea91f4..29af23830 100644
--- a/test/synchro/DataSynchroTest.php
+++ b/test/synchro/DataSynchroTest.php
@@ -30,6 +30,7 @@ use utils;
*
* @package Combodo\iTop\Test\UnitTest\Synchro
* @group dataSynchro
+ * @group defaultProfiles
*
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled
diff --git a/test/webservices/RestTest.php b/test/webservices/RestTest.php
index 8e3c95018..d71cefa86 100644
--- a/test/webservices/RestTest.php
+++ b/test/webservices/RestTest.php
@@ -9,6 +9,7 @@ use Exception;
/**
* @group itopRequestMgmt
* @group restApi
+ * @group defaultProfiles
*
* @runTestsInSeparateProcesses
* @preserveGlobalState disabled