Compare commits

..

1 Commits

Author SHA1 Message Date
odain
c8223d0cb9 N°10035 - Propagate proper HTTP_REFERER after authentication 2026-09-07 12:07:50 +02:00
12 changed files with 21 additions and 3108 deletions

View File

@@ -9,7 +9,6 @@ body:
- Please describe what's your improvement proposition.
- Then tell us if you're willing to create a PR for this enhancement ? If so, we'll indicate in the issue if we're interested in it.
- The more users are affected and the greater is the impact, the more likely this improvement will be accepted. If you identified a bug and have an improvement proposition, please use the 'Bug report' template instead."
Please note we're not willing to accept code improvement (e.g. refactoring) that won't have a "functional" change for the user.
- type: textarea
id: enhancement_details

View File

@@ -2,11 +2,8 @@
IMPORTANT: Before creating your PR, please create an issue first to know if Combodo is interested in your contribution (not needed for translations PR).
Since we may refuse a PR, it's preferable to create an issue first, to avoid spending time coding something that won't be accepted.
PR that will benefit the most users and has a greater impact on the product are more likely to be accepted, so please explain your use case and why you think it would be useful for the community.
We're not willing to receive PR concerning codes improvements (e.g. code refactoring), except if it's part of a code that brings/corrects a feature for users.
Please note that we're working with sprints, so we reserve the right to decline a PR if we do not plan to work on that subject in the 6 coming months.
Thank you for your comprehension 😊
Once you've created the issue, and we confirmed we're interested in it, please follow the guidelines within this PR template before submitting it, it will greatly help us process your PR. 🙏
Once you've done it, and we confirmed we're interested in it, please follow the guidelines within this PR template before submitting it, it will greatly help us process your PR. 🙏
Any PRs not following the guidelines or with missing information will not be considered.
-->

View File

@@ -61,7 +61,7 @@ foreach ($aTcpdfFontsDirContent as $sTcpdfFontResourceName) {
* 2) Then adding the DroidSansFallback font (useful for CJK data for example)
*/
echo $sCurrentScriptFileName.": ---2) Copying font files to TCPDF ($sTcPdfFontsFolder)...\n";
$aFontFilesToCopy = glob(__DIR__.DIRECTORY_SEPARATOR.'droidsansfallback.*');
$aFontFilesToCopy = glob(__DIR__.'\droidsansfallback.*');
foreach ($aFontFilesToCopy as $sFontFileToCopy) {
$sFontFileName = basename($sFontFileToCopy);
echo $sCurrentScriptFileName.': copying '.$sFontFileName."\n";

View File

@@ -187,6 +187,11 @@ class LoginWebPage extends NiceWebPage
}
}
$sReferer = $_SERVER['HTTP_REFERER'] ?? null;
if (!is_null($sReferer)) {
$aPreviousPostedVars['HTTP_REFERER'] = $sReferer;
}
$aVars = [
'bFailedLogin' => $bFailedLogin,
'sMessage' => $sMessage,

View File

@@ -1,19 +0,0 @@
/*
* @copyright Copyright (C) 2010-2024 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
// Overload of the default dialog widget
$.widget('ui.dialog', $.ui.dialog, {
_allowInteraction: function (oEvent) {
const oTarget = $(oEvent.target);
// If we interact with a CKEditor instance in fullscreen mode, we need to allow it
// We could check if the current instance is in the dialog, but it's easier to always allow it in fullscreen
if (oTarget.closest('.ck.ck-fullscreen__main-wrapper, .ck-body-wrapper').length > 0) {
return true;
}
// If that's not a specific case, fall back to the default behavior
return this._super(oEvent);
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -1670,7 +1670,20 @@ JS
$oExtensionsMap = iTopExtensionsMap::GetExtensionsMap($oWizard->GetParameter('target_env', ITOP_DEFAULT_ENV));
$oExtensionsMap->DeclareExtensionAsRemoved($aRemovedExtensionCodes);
return $oProductionEnv->AnalyzeInstallation($oConfig, $aDirsToScan, $bAbortOnMissingDependency, $aModulesToLoad);
$aAvailableModules = $oProductionEnv->AnalyzeInstallation($oConfig, $aDirsToScan, $bAbortOnMissingDependency, $aModulesToLoad);
$bRemoteExtensionsShouldBeMandatory = !$oWizard->GetParameter('force-uninstall', false);
if ($bRemoteExtensionsShouldBeMandatory) {
foreach ($aAvailableModules as $key => $aModule) {
$bIsExtra = (array_key_exists('root_dir', $aModule) && (strpos($aModule['root_dir'], $sExtraDir) !== false)); // Some modules (root, datamodel) have no 'root_dir'
if ($bIsExtra) {
// Modules in data/production-modules/ are considered as mandatory and always installed
$aAvailableModules[$key]['visible'] = false;
}
}
}
return $aAvailableModules;
}
/**

View File

@@ -209,7 +209,6 @@ class iTopWebPage extends NiceWebPage implements iTabbedPage
$this->LinkScriptFromAppRoot('js/pages/backoffice/keyboard-shortcuts.js');
// Used throughout the app.
$this->LinkScriptFromAppRoot('js/pages/backoffice/dialog.js');
$this->LinkScriptFromAppRoot('js/pages/backoffice/toolbox.js');
$this->LinkScriptFromAppRoot('js/pages/backoffice/on-ready.js');

View File

@@ -1,38 +0,0 @@
<?php
/*
* @copyright Copyright (C) 2010-2026 Combodo SAS
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Test\UnitTest\DotMake\Dependencies\Composer\Tcpdf;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
/**
* @coversNothing
*/
class TcpdfUpdateFontsTest extends ItopTestCase
{
public function testThatDroidSansFallbackFilesAreCopiedToTcpdfFontsFolderAfterLibraryUpdate(): void
{
$sSourcePattern = APPROOT
.'.make'.DIRECTORY_SEPARATOR.'dependencies'.DIRECTORY_SEPARATOR.'composer'.DIRECTORY_SEPARATOR.'tcpdf'.DIRECTORY_SEPARATOR.'droidsansfallback.*';
$aSourceFiles = glob($sSourcePattern);
$this->assertIsArray($aSourceFiles, 'Unable to read source TCPDF custom font files.');
$this->assertNotEmpty($aSourceFiles, 'No source files found for pattern droidsansfallback.*');
foreach ($aSourceFiles as $sSourceFilePath) {
$sFontFileName = basename($sSourceFilePath);
$sDestinationFilePath = APPROOT
.'lib'.DIRECTORY_SEPARATOR.'tecnickcom'.DIRECTORY_SEPARATOR.'tcpdf'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$sFontFileName;
$this->assertFileExists($sDestinationFilePath, "Missing copied font file: {$sFontFileName}");
$this->assertSame(
hash_file('sha256', $sSourceFilePath),
hash_file('sha256', $sDestinationFilePath),
"Copied font file content mismatch: {$sFontFileName}"
);
}
}
}

View File

@@ -2,13 +2,9 @@
namespace Combodo\iTop\Test\UnitTest\Setup;
use AnalyzeInstallation;
use CheckResult;
use Combodo\iTop\Setup\FeatureRemoval\ModelReflectionSerializer;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use Config;
use ModuleDiscovery;
use WizardController;
use SetupUtils;
/**
@@ -32,13 +28,6 @@ class SetupUtilsTest extends ItopTestCase
$this->RequireOnceItopFile('setup/setuputils.class.inc.php');
$this->RequireOnceItopFile('setup/setuppage.class.inc.php');
$this->RequireOnceItopFile('setup/wizardcontroller.class.inc.php');
}
protected function tearDown(): void
{
parent::tearDown();
ModuleDiscovery::ResetCache();
}
/**
@@ -230,30 +219,6 @@ OUTPUT;
$this->ValidateCheckResults($expected, $aRes);
}
/**
* Bug N°10045
*/
public function testAnalyzeInstallationDoesNotAutomaticallySetModulesInProductionModulesVisibilityToFalse()
{
$this->RequireOnceItopFile('setup/moduleinstallation/AnalyzeInstallation.php');
$this->SetNonPublicProperty(AnalyzeInstallation::GetInstance(), 'aAvailableModules', null);
$sRemoteEnv = 'production-temp';
$sExtraDir = \utils::GetDataPath().$sRemoteEnv.'-modules/';
$sExtraModuleName = 'extra-module';
$this->createModule($sExtraDir, $sExtraModuleName, '1.0.0');
$oWizard = new WizardController('WizStepWelcome');
$oWizard->SetParameter('source_dir', APPROOT.'datamodels/2.x');
$oWizard->SetParameter('remote_env', $sRemoteEnv);
$aModules = SetupUtils::AnalyzeInstallation($oWizard);
$this->assertContains($sExtraModuleName, array_keys($aModules), 'Module discovery should have found the extra module');
$this->assertTrue($aModules[$sExtraModuleName]['visible'], 'AnalyzeInstallation should not have automatically set the extra module visibility to false');
}
private function ValidateCheckResults(array $expected, array $aActualCheckResults)
{
$aActual = [];
@@ -267,37 +232,4 @@ OUTPUT;
self::assertEquals($expected, $aActual);
}
protected function createModule($sDirectory, $sModuleName, $sModuleVersion, $bMandatory = false, $bVisible = true)
{
$sModuleDir = $sDirectory.'/'.$sModuleName;
SetupUtils::builddir($sModuleDir);
$this->aFileToClean[] = $sDirectory;
$sModuleFileName = $sModuleDir.'/module.'.$sModuleName.'.php';
$sMandatory = var_export($bMandatory, true);
$sVisible = var_export($bVisible, true);
file_put_contents(
$sModuleFileName,
<<<PHP
<?php
SetupWebPage::AddModule(
__FILE__,
"$sModuleName/$sModuleVersion",
[
'label' => "$sModuleName",
'dependencies' => [],
'mandatory' => $sMandatory,
'visible' => $sVisible,
'datamodel' => [],
'data.struct' => [],
'data.sample' => [],
'doc.manual_setup' => '',
'doc.more_information' => '',
]
);
PHP
);
}
}