Skip to content

Commit 9dd5452

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-1120
2 parents 2c6a95a + 3a25a26 commit 9dd5452

File tree

331 files changed

+7685
-1211
lines changed

Some content is hidden

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

331 files changed

+7685
-1211
lines changed

app/bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
</div>
2828
HTML;
2929
}
30+
http_response_code(503);
3031
exit(1);
3132
}
3233

app/code/Magento/AdvancedPricingImportExport/Model/Import/AdvancedPricing.php

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ protected function saveAndReplaceAdvancedPrices()
390390
$listSku = [];
391391
$tierPrices = [];
392392
while ($bunch = $this->_dataSourceModel->getNextBunch()) {
393+
$bunchTierPrices = [];
393394
foreach ($bunch as $rowNum => $rowData) {
394395
if (!$this->validateRow($rowData, $rowNum)) {
395396
$this->addRowError(ValidatorInterface::ERROR_SKU_IS_EMPTY, $rowNum);
@@ -403,7 +404,7 @@ protected function saveAndReplaceAdvancedPrices()
403404
$rowSku = $rowData[self::COL_SKU];
404405
$listSku[] = $rowSku;
405406
if (!empty($rowData[self::COL_TIER_PRICE_WEBSITE])) {
406-
$tierPrices[$rowSku][] = [
407+
$tierPrice = [
407408
'all_groups' => $rowData[self::COL_TIER_PRICE_CUSTOMER_GROUP] == self::VALUE_ALL_GROUPS,
408409
'customer_group_id' => $this->getCustomerGroupId(
409410
$rowData[self::COL_TIER_PRICE_CUSTOMER_GROUP]
@@ -415,17 +416,26 @@ protected function saveAndReplaceAdvancedPrices()
415416
? $rowData[self::COL_TIER_PRICE] : null,
416417
'website_id' => $this->getWebSiteId($rowData[self::COL_TIER_PRICE_WEBSITE])
417418
];
419+
if (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) {
420+
$bunchTierPrices[$rowSku][] = $tierPrice;
421+
}
422+
if (\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE == $behavior) {
423+
$tierPrices[$rowSku][] = $tierPrice;
424+
}
418425
}
419426
}
420427

421428
if (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) {
422-
$this->processCountExistingPrices($tierPrices, self::TABLE_TIER_PRICE)
423-
->processCountNewPrices($tierPrices);
429+
$this->processCountExistingPrices($bunchTierPrices, self::TABLE_TIER_PRICE)
430+
->processCountNewPrices($bunchTierPrices);
424431

425-
$this->saveProductPrices($tierPrices, self::TABLE_TIER_PRICE);
426-
if ($listSku) {
427-
$this->setUpdatedAt($listSku);
428-
}
432+
$this->saveProductPrices($bunchTierPrices, self::TABLE_TIER_PRICE);
433+
}
434+
}
435+
436+
if (\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND == $behavior) {
437+
if ($listSku) {
438+
$this->setUpdatedAt($listSku);
429439
}
430440
}
431441

app/code/Magento/Authorization/Model/Acl/AclRetriever.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222
class AclRetriever
2323
{
24-
const PERMISSION_ANONYMOUS = 'anonymous';
25-
const PERMISSION_SELF = 'self';
24+
public const PERMISSION_ANONYMOUS = 'anonymous';
25+
public const PERMISSION_SELF = 'self';
2626

2727
/**
2828
* @var \Psr\Log\LoggerInterface
@@ -117,7 +117,7 @@ public function getAllowedResourcesByRole($roleId)
117117
/** @var \Magento\Authorization\Model\Rules $ruleItem */
118118
foreach ($rulesCollection->getItems() as $ruleItem) {
119119
$resourceId = $ruleItem->getResourceId();
120-
if ($acl->has($resourceId) && $acl->isAllowed($roleId, $resourceId)) {
120+
if ($acl->hasResource($resourceId) && $acl->isAllowed($roleId, $resourceId)) {
121121
$allowedResources[] = $resourceId;
122122
}
123123
}

app/code/Magento/Authorization/Model/Acl/Loader/Rule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ private function applyPermissionsAccordingToRules(Acl $acl): array
104104
$resource = $rule['resource_id'];
105105
$privileges = !empty($rule['privileges']) ? explode(',', $rule['privileges']) : null;
106106

107-
if ($acl->has($resource)) {
107+
if ($acl->hasResource($resource)) {
108108
$foundResources[$resource] = $resource;
109109
if ($rule['permission'] == 'allow') {
110110
if ($resource === $this->_rootResource->getId()) {

app/code/Magento/Authorization/Model/Acl/Role/Generic.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*/
66
namespace Magento\Authorization\Model\Acl\Role;
77

8+
use Laminas\Permissions\Acl\Role\GenericRole;
9+
810
/**
911
* Generic acl role
1012
*/
11-
class Generic extends \Zend_Acl_Role
13+
class Generic extends GenericRole
1214
{
1315
}

app/code/Magento/Authorization/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The Magento_Authorization module enables management of access control list roles
44

55
## Installation details
66

7-
The Magento_AdminNotification module creates the following tables in the database:
7+
The Magento_Authorization module creates the following tables in the database using `db_schema.xml`:
88

99
- `authorization_role`
1010
- `authorization_rule`

app/code/Magento/Authorization/Test/Unit/Model/Acl/AclRetrieverTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ protected function createAclRetriever()
165165
/**
166166
* @var Acl|MockObject $aclMock
167167
*/
168-
$aclMock = $this->createPartialMock(Acl::class, ['has', 'isAllowed']);
169-
$aclMock->expects($this->any())->method('has')->willReturn(true);
170-
$aclMock->expects($this->any())->method('isAllowed')->willReturn(true);
168+
$aclMock = $this->createPartialMock(Acl::class, ['hasResource', 'isAllowed']);
169+
$aclMock->method('hasResource')->willReturn(true);
170+
$aclMock->method('isAllowed')->willReturn(true);
171171

172172
/**
173173
* @var Builder|MockObject $aclBuilderMock

app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function testPopulateAclFromCache(): void
114114
);
115115

116116
$aclMock = $this->createMock(Acl::class);
117-
$aclMock->method('has')->willReturn(true);
117+
$aclMock->method('hasResource')->willReturn(true);
118118
$aclMock
119119
->method('allow')
120120
->withConsecutive(

app/code/Magento/Backend/Controller/Adminhtml/System/Design/Save.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace Magento\Backend\Controller\Adminhtml\System\Design;
88

99
use Magento\Framework\App\Action\HttpPostActionInterface;
10+
use Magento\Framework\Filter\FilterInput;
1011

1112
/**
1213
* Save design action.
@@ -21,13 +22,13 @@ class Save extends \Magento\Backend\Controller\Adminhtml\System\Design implement
2122
*/
2223
protected function _filterPostData($data)
2324
{
24-
$inputFilter = new \Zend_Filter_Input(
25+
$inputFilter = new FilterInput(
2526
['date_from' => $this->dateFilter, 'date_to' => $this->dateFilter],
2627
[],
2728
$data
2829
);
29-
$data = $inputFilter->getUnescaped();
30-
return $data;
30+
31+
return $inputFilter->getUnescaped();
3132
}
3233

3334
/**

app/code/Magento/Backend/Model/Auth/Session.php

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
* @api
1919
* @method \Magento\User\Model\User|null getUser()
2020
* @method \Magento\Backend\Model\Auth\Session setUser(\Magento\User\Model\User $value)
21-
* @method \Magento\Framework\Acl|null getAcl()
22-
* @method \Magento\Backend\Model\Auth\Session setAcl(\Magento\Framework\Acl $value)
2321
* @method int getUpdatedAt()
2422
* @method \Magento\Backend\Model\Auth\Session setUpdatedAt(int $value)
2523
*
@@ -62,6 +60,11 @@ class Session extends \Magento\Framework\Session\SessionManager implements \Mage
6260
*/
6361
private $messageManager;
6462

63+
/**
64+
* @var \Magento\Framework\Acl|null
65+
*/
66+
private $acl = null;
67+
6568
/**
6669
* @param \Magento\Framework\App\Request\Http $request
6770
* @param \Magento\Framework\Session\SidResolverInterface $sidResolver
@@ -152,7 +155,7 @@ public function isAllowed($resource, $privilege = null)
152155
return $acl->isAllowed($user->getAclRole(), $resource, $privilege);
153156
} catch (\Exception $e) {
154157
try {
155-
if (!$acl->has($resource)) {
158+
if (!$acl->hasResource($resource)) {
156159
return $acl->isAllowed($user->getAclRole(), null, $privilege);
157160
}
158161
} catch (\Exception $e) {
@@ -284,4 +287,33 @@ public function isValidForPath($path)
284287
{
285288
return true;
286289
}
290+
291+
/**
292+
* Set Acl model
293+
*
294+
* @return \Magento\Framework\Acl
295+
*/
296+
public function getAcl()
297+
{
298+
return $this->acl;
299+
}
300+
301+
/**
302+
* Retrieve Acl
303+
*
304+
* @param \Magento\Framework\Acl $acl
305+
* @return void
306+
*/
307+
public function setAcl(\Magento\Framework\Acl $acl)
308+
{
309+
$this->acl = $acl;
310+
}
311+
312+
/**
313+
* @inheritdoc
314+
*/
315+
public function getData($key = '', $clear = false)
316+
{
317+
return $key === 'acl' ? $this->getAcl() : parent::getData($key, $clear);
318+
}
287319
}

0 commit comments

Comments
 (0)