7
7
8
8
namespace Magento \Authorization \Model \Acl \Loader ;
9
9
10
+ use Magento \Framework \Acl ;
10
11
use Magento \Framework \Acl \Data \CacheInterface ;
11
12
use Magento \Framework \Acl \LoaderInterface ;
12
13
use Magento \Framework \Acl \RootResource ;
@@ -31,27 +32,27 @@ class Rule implements LoaderInterface
31
32
/**
32
33
* @var ResourceConnection
33
34
*/
34
- private ResourceConnection $ _resource ;
35
+ protected $ _resource ;
35
36
36
37
/**
37
38
* @var RootResource
38
39
*/
39
- private RootResource $ _rootResource ;
40
+ private $ _rootResource ;
40
41
41
42
/**
42
43
* @var CacheInterface
43
44
*/
44
- private CacheInterface $ aclDataCache ;
45
+ private $ aclDataCache ;
45
46
46
47
/**
47
48
* @var Json
48
49
*/
49
- private Json $ serializer ;
50
+ private $ serializer ;
50
51
51
52
/**
52
53
* @var string
53
54
*/
54
- private string $ cacheKey ;
55
+ private $ cacheKey ;
55
56
56
57
/**
57
58
* @param RootResource $rootResource
@@ -80,10 +81,10 @@ public function __construct(
80
81
/**
81
82
* Populate ACL with rules from external storage
82
83
*
83
- * @param \Magento\Framework\ Acl $acl
84
+ * @param Acl $acl
84
85
* @return void
85
86
*/
86
- public function populateAcl (\ Magento \ Framework \ Acl $ acl )
87
+ public function populateAcl (Acl $ acl )
87
88
{
88
89
$ result = $ this ->applyPermissionsAccordingToRules ($ acl );
89
90
$ this ->applyDenyPermissionsForMissingRules ($ acl , ...$ result );
@@ -92,10 +93,10 @@ public function populateAcl(\Magento\Framework\Acl $acl)
92
93
/**
93
94
* Apply ACL with rules
94
95
*
95
- * @param \Magento\Framework\ Acl $acl
96
+ * @param Acl $acl
96
97
* @return array[]
97
98
*/
98
- private function applyPermissionsAccordingToRules (\ Magento \ Framework \ Acl $ acl ): array
99
+ private function applyPermissionsAccordingToRules (Acl $ acl ): array
99
100
{
100
101
$ foundResources = $ foundDeniedRoles = [];
101
102
foreach ($ this ->getRulesArray () as $ rule ) {
@@ -124,19 +125,19 @@ private function applyPermissionsAccordingToRules(\Magento\Framework\Acl $acl):
124
125
* when adding a new module and without re-saving all roles,
125
126
* consider not present rules with deny permissions
126
127
*
127
- * @param \Magento\Framework\ Acl $acl
128
+ * @param Acl $acl
128
129
* @param array $resources
129
130
* @param array $deniedRoles
130
131
* @return void
131
132
*/
132
133
private function applyDenyPermissionsForMissingRules (
133
- \ Magento \ Framework \ Acl $ acl ,
134
+ Acl $ acl ,
134
135
array $ resources ,
135
136
array $ deniedRoles
136
137
) {
137
138
if (count ($ resources ) && count ($ deniedRoles )
138
139
//ignore denying missing permission if all are allowed
139
- && !(count ($ resources ) == 1 && isset ($ resources [static ::ALLOW_EVERYTHING ]))
140
+ && !(count ($ resources ) === 1 && isset ($ resources [static ::ALLOW_EVERYTHING ]))
140
141
) {
141
142
foreach ($ acl ->getResources () as $ resource ) {
142
143
if (!isset ($ resources [$ resource ])) {
0 commit comments