Skip to content

Commit 420efe2

Browse files
committed
Merge remote-tracking branch 'origin/2.4-develop' into ACPT-672
2 parents 6342bfc + c4b343b commit 420efe2

File tree

159 files changed

+2802
-633
lines changed

Some content is hidden

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

159 files changed

+2802
-633
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/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/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
}

app/code/Magento/Backend/Test/Unit/Model/Auth/SessionTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function setUp(): void
7979
['getCookie', 'setPublicCookie']
8080
);
8181
$this->storage = $this->getMockBuilder(Storage::class)
82-
->addMethods(['getUser', 'getAcl', 'setAcl'])
82+
->addMethods(['getUser'])
8383
->disableOriginalConstructor()
8484
->getMock();
8585
$this->sessionConfig = $this->createPartialMock(
@@ -133,8 +133,6 @@ public function testRefreshAcl($isUserPassedViaParams)
133133
$userMock->expects($this->any())->method('getReloadAclFlag')->willReturn(true);
134134
$userMock->expects($this->once())->method('setReloadAclFlag')->with('0')->willReturnSelf();
135135
$userMock->expects($this->once())->method('save');
136-
$this->storage->expects($this->once())->method('setAcl')->with($aclMock);
137-
$this->storage->expects($this->any())->method('getAcl')->willReturn($aclMock);
138136
if ($isUserPassedViaParams) {
139137
$this->session->refreshAcl($userMock);
140138
} else {
@@ -250,7 +248,7 @@ public function testIsAllowed($isUserDefined, $isAclDefined, $isAllowed, $expect
250248
$aclMock = $this->getMockBuilder(Acl::class)
251249
->disableOriginalConstructor()
252250
->getMock();
253-
$this->storage->expects($this->any())->method('getAcl')->willReturn($aclMock);
251+
$this->session->setAcl($aclMock);
254252
}
255253
if ($isUserDefined) {
256254
$userMock = $this->getMockBuilder(User::class)

app/code/Magento/Bundle/Test/Mftf/Test/AdvanceCatalogSearchBundleByDescriptionTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<severity value="MAJOR"/>
1818
<testCaseId value="MC-25427"/>
1919
<group value="bundle"/>
20-
<group value="SearchEngineElasticsearch"/>
20+
<group value="SearchEngine"/>
2121
<group value="pr_exclude"/>
2222
</annotations>
2323
<before>

0 commit comments

Comments
 (0)