Skip to content

Commit 12a12bd

Browse files
authored
Merge branch '2.4.3-develop' into cia-2.4.3-bugfixes-4222021
2 parents 3519add + 8528e93 commit 12a12bd

File tree

101 files changed

+2732
-666
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+2732
-666
lines changed

app/code/Magento/AdvancedPricingImportExport/Controller/Adminhtml/Export/GetFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public function execute()
3434
/** @var $export \Magento\ImportExport\Model\Export */
3535
$export = $this->_objectManager->create(\Magento\ImportExport\Model\Export::class);
3636
$export->setData($data);
37-
$attrFilterBlock->prepareCollection(
38-
$export->filterAttributeCollection($export->getEntityAttributeCollection())
37+
$export->filterAttributeCollection(
38+
$attrFilterBlock->prepareCollection($export->getEntityAttributeCollection())
3939
);
4040
return $resultLayout;
4141
} catch (\Exception $e) {

app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingButtonTest.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1010
<test name="AdminAdvancedReportingButtonTest">
1111
<annotations>
12-
<stories value="AdvancedReporting"/>
13-
<title value="AdvancedReportingButtonTest"/>
14-
<description value="Test log in to AdvancedReporting and tests AdvancedReportingButtonTest"/>
15-
<testCaseId value="MC-14800"/>
16-
<skip>
17-
<issueId value="MC-14800" />
18-
</skip>
12+
<features value="Analytics"/>
13+
<stories value="Advanced Reporting"/>
14+
<title value="Assert the Advanced Reporting page is opened by dashboard link"/>
15+
<description value="Check the ability to navigate to the Advanced Reporting page through the Advanced Reporting button on the dashboard"/>
1916
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-28376"/>
2018
<group value="analytics"/>
2119
<group value="mtf_migrated"/>
2220
</annotations>

app/code/Magento/Backend/App/Action/Plugin/Authentication.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,10 @@ protected function _redirectIfNeededAfterLogin(\Magento\Framework\App\RequestInt
225225

226226
// Checks, whether secret key is required for admin access or request uri is explicitly set
227227
if ($this->_url->useSecretKey()) {
228-
$requestParts = explode('/', trim($request->getRequestUri(), '/'), 2);
229-
$requestUri = $this->_url->getUrl(array_pop($requestParts));
228+
$requestParts = explode('/', trim($request->getRequestUri(), '/'), 3);
229+
$baseUrlPath = trim(parse_url($this->backendUrl->getBaseUrl(), PHP_URL_PATH), '/');
230+
$routeIndex = empty($baseUrlPath) ? 0 : 1;
231+
$requestUri = $this->_url->getUrl($requestParts[$routeIndex]);
230232
} elseif ($request) {
231233
$requestUri = $request->getRequestUri();
232234
}

app/code/Magento/Backend/Controller/Adminhtml/Auth/Login.php

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
76
namespace Magento\Backend\Controller\Adminhtml\Auth;
87

8+
use Magento\Backend\App\Area\FrontNameResolver;
9+
use Magento\Backend\App\BackendAppList;
10+
use Magento\Backend\Model\UrlFactory;
911
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGet;
1012
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPost;
13+
use Magento\Framework\App\ObjectManager;
14+
use Magento\Framework\App\Request\Http;
1115

1216
/**
1317
* @api
@@ -20,18 +24,50 @@ class Login extends \Magento\Backend\Controller\Adminhtml\Auth implements HttpGe
2024
*/
2125
protected $resultPageFactory;
2226

27+
/**
28+
* @var FrontNameResolver
29+
*/
30+
private $frontNameResolver;
31+
32+
/**
33+
* @var BackendAppList
34+
*/
35+
private $backendAppList;
36+
37+
/**
38+
* @var UrlFactory
39+
*/
40+
private $backendUrlFactory;
41+
42+
/**
43+
* @var Http
44+
*/
45+
private $http;
46+
2347
/**
2448
* Constructor
2549
*
2650
* @param \Magento\Backend\App\Action\Context $context
2751
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
52+
* @param FrontNameResolver|null $frontNameResolver
53+
* @param BackendAppList|null $backendAppList
54+
* @param UrlFactory|null $backendUrlFactory
55+
* @param Http|null $http
2856
*/
2957
public function __construct(
3058
\Magento\Backend\App\Action\Context $context,
31-
\Magento\Framework\View\Result\PageFactory $resultPageFactory
59+
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
60+
FrontNameResolver $frontNameResolver = null,
61+
BackendAppList $backendAppList = null,
62+
UrlFactory $backendUrlFactory = null,
63+
Http $http = null
3264
) {
3365
$this->resultPageFactory = $resultPageFactory;
3466
parent::__construct($context);
67+
$this->frontNameResolver = $frontNameResolver ?? ObjectManager::getInstance()->get(FrontNameResolver::class);
68+
$this->backendAppList = $backendAppList ?? ObjectManager::getInstance()->get(BackendAppList::class);
69+
$this->backendUrlFactory = $backendUrlFactory ?? ObjectManager::getInstance()->get(UrlFactory::class);
70+
$this->http = $http ?? ObjectManager::getInstance()->get(Http::class);
3571
}
3672

3773
/**
@@ -49,7 +85,8 @@ public function execute()
4985
}
5086

5187
$requestUrl = $this->getRequest()->getUri();
52-
if (!$requestUrl->isValid()) {
88+
89+
if (!$requestUrl->isValid() || !$this->isValidBackendUri()) {
5390
return $this->getRedirect($this->getUrl('*'));
5491
}
5592

@@ -69,4 +106,26 @@ private function getRedirect($path)
69106
$resultRedirect->setPath($path);
70107
return $resultRedirect;
71108
}
109+
110+
/**
111+
* Verify if correct backend uri requested.
112+
*
113+
* @return bool
114+
*/
115+
private function isValidBackendUri(): bool
116+
{
117+
$requestUri = $this->getRequest()->getRequestUri();
118+
$backendApp = $this->backendAppList->getCurrentApp();
119+
$baseUrl = parse_url($this->backendUrlFactory->create()->getBaseUrl(), PHP_URL_PATH);
120+
if (!$backendApp) {
121+
$backendFrontName = $this->frontNameResolver->getFrontName();
122+
} else {
123+
//In case of application authenticating through the admin login, the script name should be removed
124+
//from the path, because application has own script.
125+
$baseUrl = $this->http->getUrlNoScript($baseUrl);
126+
$backendFrontName = $backendApp->getCookiePath();
127+
}
128+
129+
return strpos($requestUri, $baseUrl . $backendFrontName) === 0;
130+
}
72131
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="AdminEnableUrlRewritesConfigData">
12+
<data key="path">web/seo/use_rewrites</data>
13+
<data key="value">1</data>
14+
</entity>
15+
<entity name="AdminDisableUrlRewritesConfigData">
16+
<data key="path">web/seo/use_rewrites</data>
17+
<data key="value">0</data>
18+
</entity>
19+
</entities>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
10+
<entity name="SystemUploadConfigurationMaxWidth">
11+
<data key="path">system/upload_configuration/max_width</data>
12+
<data key="value">1920</data>
13+
</entity>
14+
<entity name="SystemUploadConfigurationMaxHeight">
15+
<data key="path">system/upload_configuration/max_height</data>
16+
<data key="value">1200</data>
17+
</entity>
18+
</entities>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminLoginSuccessfulWithRewritesDisabledTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Login on the Admin Login page"/>
15+
<title
16+
value="Admin should be able to log into the Magento Admin backend successfully if url rewrites are disabled"/>
17+
<description
18+
value="Admin should be able to log into the Magento Admin backend successfully if url rewrites are disabled"/>
19+
<severity value="CRITICAL"/>
20+
<group value="example"/>
21+
<group value="login"/>
22+
</annotations>
23+
24+
<before>
25+
<magentoCLI command="config:set {{AdminDisableUrlRewritesConfigData.path}} {{AdminDisableUrlRewritesConfigData.value}}" stepKey="disableUrlRewrites"/>
26+
</before>
27+
<after>
28+
<magentoCLI command="config:set {{AdminEnableUrlRewritesConfigData.path}} {{AdminEnableUrlRewritesConfigData.value}}" stepKey="enableUrlRewrites"/>
29+
</after>
30+
31+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
32+
<actionGroup ref="AssertAdminSuccessLoginActionGroup" stepKey="assertLoggedIn"/>
33+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/>
34+
</test>
35+
</tests>

0 commit comments

Comments
 (0)