Skip to content

Commit 7f7d82e

Browse files
committed
ACP2E-4114: Production ACL Permission Check caused Performance Degradation – populateAcl Method is the bottleneck
1 parent 05f06c1 commit 7f7d82e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ public function __construct(
7575
ResourceConnection $resource,
7676
CacheInterface $aclDataCache,
7777
Json $serializer,
78-
array $data = [],
79-
string $cacheKey = self::ACL_RULE_CACHE_KEY,
78+
?array $data = [],
79+
?string $cacheKey = self::ACL_RULE_CACHE_KEY,
8080
?CurrentRoleContext $roleContext = null
8181
) {
8282
$this->_rootResource = $rootResource;
8383
$this->_resource = $resource;
8484
$this->aclDataCache = $aclDataCache;
8585
$this->serializer = $serializer;
86-
$this->cacheKey = $cacheKey;
86+
$this->cacheKey = $cacheKey ?? self::ACL_RULE_CACHE_KEY;
8787

8888
$this->roleContext = $roleContext ?? \Magento\Framework\App\ObjectManager::getInstance()
8989
->get(CurrentRoleContext::class);

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Framework\App\ResourceConnection;
1515
use Magento\Framework\Serialize\Serializer\Json;
1616
use PHPUnit\Framework\MockObject\Exception;
17+
use Magento\Framework\Acl\Role\CurrentRoleContext;
1718
use PHPUnit\Framework\MockObject\MockObject;
1819
use PHPUnit\Framework\TestCase;
1920

@@ -80,11 +81,16 @@ static function ($value) {
8081
}
8182
);
8283

84+
$ruleContext = $this->createMock(CurrentRoleContext::class);
85+
8386
$this->model = new Rule(
8487
$this->rootResource,
8588
$this->resourceMock,
8689
$this->aclDataCacheMock,
87-
$this->serializerMock
90+
$this->serializerMock,
91+
null,
92+
null,
93+
$ruleContext
8894
);
8995
}
9096

0 commit comments

Comments
 (0)