Skip to content

Commit 153db0b

Browse files
committed
Merge remote-tracking branch 'origin' into ac1955new
2 parents 54ee6a3 + e304792 commit 153db0b

File tree

1,740 files changed

+37322
-22722
lines changed

Some content is hidden

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

1,740 files changed

+37322
-22722
lines changed

app/code/Magento/AdvancedSearch/Block/SearchDataInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\AdvancedSearch\Block;
79

810
/**
911
* Interface \Magento\AdvancedSearch\Block\SearchDataInterface
1012
*
13+
* @api
1114
*/
1215
interface SearchDataInterface
1316
{

app/code/Magento/Analytics/Api/Data/LinkInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Analytics\Api\Data;
79

810
/**
911
* Represents link with collected data and initialized vector for decryption.
12+
*
13+
* @api
1014
*/
1115
interface LinkInterface
1216
{

app/code/Magento/Analytics/Api/LinkProviderInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Analytics\Api;
79

810
/**
911
* Provides link to file with collected report data.
12+
*
13+
* @api
1014
*/
1115
interface LinkProviderInterface
1216
{

app/code/Magento/Analytics/Model/Connector/CommandInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Analytics\Model\Connector;
79

810
/**
911
* Introduces family of integration calls.
1012
* Each implementation represents call to external service.
13+
*
14+
* @api
1115
*/
1216
interface CommandInterface
1317
{

app/code/Magento/Analytics/Model/ExportDataHandlerInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Analytics\Model;
79

810
/**
911
* The interface represents the type of classes that handling of a new data collection for MBI.
12+
*
13+
* @api
1014
*/
1115
interface ExportDataHandlerInterface
1216
{

app/code/Magento/Analytics/Model/ReportWriterInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Analytics\Model;
79

810
use Magento\Framework\Filesystem\Directory\WriteInterface;
@@ -14,6 +16,8 @@
1416
* Executes export of collected data
1517
* Iterates registered providers @see etc/analytics.xml
1618
* Collects data (to TMP folder)
19+
*
20+
* @api
1721
*/
1822
interface ReportWriterInterface
1923
{

app/code/Magento/Analytics/ReportXml/DB/Assembler/AssemblerInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Analytics\ReportXml\DB\Assembler;
79

810
use Magento\Analytics\ReportXml\DB\SelectBuilder;
@@ -13,6 +15,8 @@
1315
* Introduces family of SQL assemblers
1416
* Each assembler populates SelectBuilder with config information
1517
* @see usage examples at \Magento\Analytics\ReportXml\QueryFactory
18+
*
19+
* @api
1620
*/
1721
interface AssemblerInterface
1822
{

app/code/Magento/Analytics/ReportXml/DB/SelectBuilder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Responsible for Select object creation, works as a builder. Returns Select as result;
1414
*
1515
* Used in SQL assemblers.
16+
*
17+
* @api
1618
*/
1719
class SelectBuilder
1820
{

app/code/Magento/AsynchronousOperations/Model/MassPublisher.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __construct(
7979
}
8080

8181
/**
82-
* {@inheritdoc}
82+
* @inheritdoc
8383
*/
8484
public function publish($topicName, $data)
8585
{
@@ -91,6 +91,7 @@ public function publish($topicName, $data)
9191
[
9292
'body' => $message,
9393
'properties' => [
94+
'topic_name' => $topicName,
9495
'delivery_mode' => 2,
9596
'message_id' => $this->messageIdGenerator->generate($topicName),
9697
]

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

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Authorization\Model\Acl\Loader;
99

10+
use Magento\Framework\Acl;
1011
use Magento\Framework\Acl\Data\CacheInterface;
1112
use Magento\Framework\Acl\LoaderInterface;
1213
use Magento\Framework\Acl\RootResource;
@@ -21,7 +22,12 @@ class Rule implements LoaderInterface
2122
/**
2223
* Rules array cache key
2324
*/
24-
const ACL_RULE_CACHE_KEY = 'authorization_rule_cached_data';
25+
public const ACL_RULE_CACHE_KEY = 'authorization_rule_cached_data';
26+
27+
/**
28+
* Allow everything resource id
29+
*/
30+
private const ALLOW_EVERYTHING = 'Magento_Backend::all';
2531

2632
/**
2733
* @var ResourceConnection
@@ -75,27 +81,74 @@ public function __construct(
7581
/**
7682
* Populate ACL with rules from external storage
7783
*
78-
* @param \Magento\Framework\Acl $acl
84+
* @param Acl $acl
7985
* @return void
8086
*/
81-
public function populateAcl(\Magento\Framework\Acl $acl)
87+
public function populateAcl(Acl $acl)
8288
{
89+
$result = $this->applyPermissionsAccordingToRules($acl);
90+
$this->applyDenyPermissionsForMissingRules($acl, ...$result);
91+
}
92+
93+
/**
94+
* Apply ACL with rules
95+
*
96+
* @param Acl $acl
97+
* @return array[]
98+
*/
99+
private function applyPermissionsAccordingToRules(Acl $acl): array
100+
{
101+
$foundResources = $foundDeniedRoles = [];
83102
foreach ($this->getRulesArray() as $rule) {
84103
$role = $rule['role_id'];
85104
$resource = $rule['resource_id'];
86105
$privileges = !empty($rule['privileges']) ? explode(',', $rule['privileges']) : null;
87106

88107
if ($acl->has($resource)) {
108+
$foundResources[$resource] = $resource;
89109
if ($rule['permission'] == 'allow') {
90110
if ($resource === $this->_rootResource->getId()) {
91111
$acl->allow($role, null, $privileges);
92112
}
93113
$acl->allow($role, $resource, $privileges);
94114
} elseif ($rule['permission'] == 'deny') {
115+
$foundDeniedRoles[$role] = $role;
95116
$acl->deny($role, $resource, $privileges);
96117
}
97118
}
98119
}
120+
return [$foundResources, $foundDeniedRoles];
121+
}
122+
123+
/**
124+
* Apply deny permissions for missing rules
125+
*
126+
* For all rules that were not regenerated in authorization_rule table,
127+
* when adding a new module and without re-saving all roles,
128+
* consider not present rules with deny permissions
129+
*
130+
* @param Acl $acl
131+
* @param array $resources
132+
* @param array $deniedRoles
133+
* @return void
134+
*/
135+
private function applyDenyPermissionsForMissingRules(
136+
Acl $acl,
137+
array $resources,
138+
array $deniedRoles
139+
) {
140+
if (count($resources) && count($deniedRoles)
141+
//ignore denying missing permission if all are allowed
142+
&& !(count($resources) === 1 && isset($resources[static::ALLOW_EVERYTHING]))
143+
) {
144+
foreach ($acl->getResources() as $resource) {
145+
if (!isset($resources[$resource])) {
146+
foreach ($deniedRoles as $role) {
147+
$acl->deny($role, $resource, null);
148+
}
149+
}
150+
}
151+
}
99152
}
100153

101154
/**

0 commit comments

Comments
 (0)