Skip to content

Commit 2a9ab6d

Browse files
authored
Merge branch '2.4-develop' into 2.4-develop
2 parents 671bc23 + d0aa378 commit 2a9ab6d

File tree

860 files changed

+24636
-6393
lines changed

Some content is hidden

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

860 files changed

+24636
-6393
lines changed

app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationPermissionTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<click selector="{{AdminUserGridSection.searchResultFirstRow}}" stepKey="clickFoundUsername"/>
3636
<waitForPageLoad time="30" stepKey="wait2"/>
3737
<seeInField selector="{{AdminEditUserSection.usernameTextField}}" userInput="$$noReportUser.username$$" stepKey="seeUsernameInField"/>
38-
<fillField selector="{{AdminEditUserSection.currentPasswordField}}" userInput="{{_ENV.MAGENTO_ADMIN_PASSWORD}}" stepKey="fillCurrentPassword"/>
38+
<fillField selector="{{AdminEditUserSection.currentPasswordField}}" userInput="{{_CREDS.magento/MAGENTO_ADMIN_PASSWORD}}" stepKey="fillCurrentPassword"/>
3939
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
4040

4141
<click selector="{{AdminEditUserSection.userRoleTab}}" stepKey="clickUserRoleTab"/>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Suite/etc/suiteSchema.xsd">
11+
<suite name="AsyncOperationsSuite">
12+
<include>
13+
<group name="async_operations"/>
14+
</include>
15+
</suite>
16+
</suites>

app/code/Magento/AsyncConfig/Test/Mftf/Test/AsyncConfigurationTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<severity value="MAJOR"/>
1717
<testCaseId value="ACPT-885"/>
1818
<group value="configuration"/>
19+
<group value="async_operations" />
1920
</annotations>
2021
<before>
2122
<!--Enable Async Configuration-->

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
namespace Magento\AsynchronousOperations\Model;
88

9-
/**
10-
* Class AccessValidator
11-
*/
9+
use Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface;
10+
use Magento\Authorization\Model\UserContextInterface;
11+
1212
class AccessValidator
1313
{
1414
/**
15-
* @var \Magento\Authorization\Model\UserContextInterface
15+
* @var UserContextInterface
1616
*/
1717
private $userContext;
1818

@@ -27,13 +27,12 @@ class AccessValidator
2727
private $bulkSummaryFactory;
2828

2929
/**
30-
* AccessValidator constructor.
31-
* @param \Magento\Authorization\Model\UserContextInterface $userContext
30+
* @param UserContextInterface $userContext
3231
* @param \Magento\Framework\EntityManager\EntityManager $entityManager
3332
* @param \Magento\AsynchronousOperations\Api\Data\BulkSummaryInterfaceFactory $bulkSummaryFactory
3433
*/
3534
public function __construct(
36-
\Magento\Authorization\Model\UserContextInterface $userContext,
35+
UserContextInterface $userContext,
3736
\Magento\Framework\EntityManager\EntityManager $entityManager,
3837
\Magento\AsynchronousOperations\Api\Data\BulkSummaryInterfaceFactory $bulkSummaryFactory
3938
) {
@@ -50,11 +49,15 @@ public function __construct(
5049
*/
5150
public function isAllowed($bulkUuid)
5251
{
53-
/** @var \Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface $bulkSummary */
52+
/** @var BulkSummaryInterface $bulkSummary */
5453
$bulkSummary = $this->entityManager->load(
5554
$this->bulkSummaryFactory->create(),
5655
$bulkUuid
5756
);
57+
if ((int) $bulkSummary->getUserType() === UserContextInterface::USER_TYPE_INTEGRATION) {
58+
return true;
59+
}
60+
5861
return ((int) $bulkSummary->getUserId()) === ((int) $this->userContext->getUserId());
5962
}
6063
}

app/code/Magento/AsynchronousOperations/Model/BulkStatus/Options.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,29 @@
77

88
use Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface;
99

10-
/**
11-
* Class Options
12-
*/
1310
class Options implements \Magento\Framework\Data\OptionSourceInterface
1411
{
1512
/**
16-
* @return array
13+
* @inheritDoc
1714
*/
1815
public function toOptionArray()
1916
{
2017
return [
2118
[
2219
'value' => BulkSummaryInterface::NOT_STARTED,
23-
'label' => 'Not Started'
20+
'label' => __('Not Started')
2421
],
2522
[
2623
'value' => BulkSummaryInterface::IN_PROGRESS,
27-
'label' => 'In Progress'
24+
'label' => __('In Progress')
2825
],
2926
[
3027
'value' => BulkSummaryInterface::FINISHED_SUCCESSFULLY,
31-
'label' => 'Finished Successfully'
28+
'label' => __('Finished Successfully')
3229
],
3330
[
3431
'value' => BulkSummaryInterface::FINISHED_WITH_FAILURE,
35-
'label' => 'Finished with Failure'
32+
'label' => __('Finished with Failure')
3633
]
3734
];
3835
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\AsynchronousOperations\Model\BulkUserType;
9+
10+
use Magento\Authorization\Model\UserContextInterface;
11+
use Magento\Framework\Data\OptionSourceInterface;
12+
13+
class Options implements OptionSourceInterface
14+
{
15+
/**
16+
* @inheritDoc
17+
*/
18+
public function toOptionArray(): array
19+
{
20+
return [
21+
[
22+
'value' => UserContextInterface::USER_TYPE_ADMIN,
23+
'label' => __('Admin user')
24+
],
25+
[
26+
'value' => UserContextInterface::USER_TYPE_INTEGRATION,
27+
'label' => __('Integration')
28+
]
29+
];
30+
}
31+
}

app/code/Magento/AsynchronousOperations/Ui/Component/DataProvider/SearchResult.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
use Magento\Framework\Data\Collection\Db\FetchStrategyInterface as FetchStrategy;
99
use Magento\Framework\Data\Collection\EntityFactoryInterface as EntityFactory;
1010
use Magento\Framework\Event\ManagerInterface as EventManager;
11+
use Magento\Framework\Model\ResourceModel\AbstractResource;
1112
use Psr\Log\LoggerInterface as Logger;
1213
use Magento\Authorization\Model\UserContextInterface;
1314
use Magento\Framework\Bulk\BulkSummaryInterface;
1415
use Magento\AsynchronousOperations\Model\StatusMapper;
1516
use Magento\AsynchronousOperations\Model\BulkStatus\CalculatedStatusSql;
1617

17-
/**
18-
* Class SearchResult
19-
*/
2018
class SearchResult extends \Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult
2119
{
2220
/**
@@ -40,7 +38,6 @@ class SearchResult extends \Magento\Framework\View\Element\UiComponent\DataProvi
4038
private $calculatedStatusSql;
4139

4240
/**
43-
* SearchResult constructor.
4441
* @param EntityFactory $entityFactory
4542
* @param Logger $logger
4643
* @param FetchStrategy $fetchStrategy
@@ -49,7 +46,7 @@ class SearchResult extends \Magento\Framework\View\Element\UiComponent\DataProvi
4946
* @param StatusMapper $statusMapper
5047
* @param CalculatedStatusSql $calculatedStatusSql
5148
* @param string $mainTable
52-
* @param null $resourceModel
49+
* @param AbstractResource $resourceModel
5350
* @param string $identifierName
5451
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
5552
*/
@@ -80,7 +77,7 @@ public function __construct(
8077
}
8178

8279
/**
83-
* {@inheritdoc}
80+
* @inheritdoc
8481
*/
8582
protected function _initSelect()
8683
{
@@ -93,12 +90,18 @@ protected function _initSelect()
9390
)->where(
9491
'user_id=?',
9592
$this->userContext->getUserId()
93+
)->where(
94+
'user_type=?',
95+
UserContextInterface::USER_TYPE_ADMIN
96+
)->orWhere(
97+
'user_type=?',
98+
UserContextInterface::USER_TYPE_INTEGRATION
9699
);
97100
return $this;
98101
}
99102

100103
/**
101-
* {@inheritdoc}
104+
* @inheritdoc
102105
*/
103106
protected function _afterLoad()
104107
{
@@ -110,7 +113,7 @@ protected function _afterLoad()
110113
}
111114

112115
/**
113-
* {@inheritdoc}
116+
* @inheritdoc
114117
*/
115118
public function addFieldToFilter($field, $condition = null)
116119
{
@@ -133,7 +136,7 @@ public function addFieldToFilter($field, $condition = null)
133136
}
134137

135138
/**
136-
* {@inheritdoc}
139+
* @inheritdoc
137140
*/
138141
public function getSelectCountSql()
139142
{

app/code/Magento/AsynchronousOperations/i18n/en_US.csv

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,10 @@ Error,Error
3333
"Dismiss All Completed Tasks","Dismiss All Completed Tasks"
3434
"Action Details - #","Action Details - #"
3535
"Number of Records Affected","Number of Records Affected"
36+
"User Type","User Type"
37+
"Admin user","Admin user"
38+
"Integration","Integration"
39+
"Not Started","Not Started"
40+
"In Progress","In Progress"
41+
"Finished Successfully","Finished Successfully"
42+
"Finished with Failure","Finished with Failure"

app/code/Magento/AsynchronousOperations/view/adminhtml/ui_component/bulk_listing.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@
8181
<label translate="true">Description of Operation</label>
8282
</settings>
8383
</column>
84+
<column name="user_type" component="Magento_Ui/js/grid/columns/select" sortOrder="55">
85+
<settings>
86+
<filter>select</filter>
87+
<options class="\Magento\AsynchronousOperations\Model\BulkUserType\Options"/>
88+
<dataType>select</dataType>
89+
<label translate="true">User Type</label>
90+
</settings>
91+
</column>
8492
<column name="status" component="Magento_Ui/js/grid/columns/select" sortOrder="60">
8593
<settings>
8694
<filter>select</filter>
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Authorization\Model;
10+
11+
use Magento\Framework\App\Backpressure\ContextInterface;
12+
use Magento\Framework\App\Backpressure\IdentityProviderInterface;
13+
use Magento\Framework\Exception\RuntimeException;
14+
use Magento\Framework\HTTP\PhpEnvironment\RemoteAddress;
15+
16+
/**
17+
* Utilizes UserContext for backpressure identity
18+
*/
19+
class IdentityProvider implements IdentityProviderInterface
20+
{
21+
/**
22+
* User context identity type map
23+
*/
24+
private const USER_CONTEXT_IDENTITY_TYPE_MAP = [
25+
UserContextInterface::USER_TYPE_CUSTOMER => ContextInterface::IDENTITY_TYPE_CUSTOMER,
26+
UserContextInterface::USER_TYPE_ADMIN => ContextInterface::IDENTITY_TYPE_ADMIN
27+
];
28+
29+
/**
30+
* @var UserContextInterface
31+
*/
32+
private UserContextInterface $userContext;
33+
34+
/**
35+
* @var RemoteAddress
36+
*/
37+
private RemoteAddress $remoteAddress;
38+
39+
/**
40+
* @param UserContextInterface $userContext
41+
* @param RemoteAddress $remoteAddress
42+
*/
43+
public function __construct(UserContextInterface $userContext, RemoteAddress $remoteAddress)
44+
{
45+
$this->userContext = $userContext;
46+
$this->remoteAddress = $remoteAddress;
47+
}
48+
49+
/**
50+
* @inheritDoc
51+
*
52+
* @throws RuntimeException
53+
*/
54+
public function fetchIdentityType(): int
55+
{
56+
if (!$this->userContext->getUserId()) {
57+
return ContextInterface::IDENTITY_TYPE_IP;
58+
}
59+
60+
$userType = $this->userContext->getUserType();
61+
if (isset(self::USER_CONTEXT_IDENTITY_TYPE_MAP[$userType])) {
62+
return self::USER_CONTEXT_IDENTITY_TYPE_MAP[$userType];
63+
}
64+
65+
throw new RuntimeException(__('User type not defined'));
66+
}
67+
68+
/**
69+
* @inheritDoc
70+
*
71+
* @throws RuntimeException
72+
*/
73+
public function fetchIdentity(): string
74+
{
75+
$userId = $this->userContext->getUserId();
76+
if ($userId) {
77+
return (string)$userId;
78+
}
79+
80+
$address = $this->remoteAddress->getRemoteAddress();
81+
if (!$address) {
82+
throw new RuntimeException(__('Failed to extract remote address'));
83+
}
84+
85+
return $address;
86+
}
87+
}

0 commit comments

Comments
 (0)