1-
2- ignores group_id
3-
4- ---
5- .../Customer/Model/AccountManagement.php | 5 -
6- .../Customer/Model/AccountManagementApi.php | 132 ++++++
7- ...AsyncRequestCustomerGroupAuthorization.php | 78 ++++
8- .../Unit/Model/AccountManagementApiTest.php | 421 ++++++++++++++++++
9- .../Test/Unit/Model/AccountManagementTest.php | 4 -
10- ...cRequestCustomerGroupAuthorizationTest.php | 112 +++++
11- app/code/Magento/Customer/composer.json | 3 +-
12- app/code/Magento/Customer/etc/di.xml | 5 +
13- 8 files changed, 750 insertions(+), 10 deletions(-)
14- create mode 100644 app/code/Magento/Customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
15- create mode 100644 app/code/Magento/Customer/Test/Unit/Model/AccountManagementApiTest.php
16- create mode 100644 app/code/Magento/Customer/Test/Unit/Plugin/AsyncRequestCustomerGroupAuthorizationTest.php
17-
181diff --git a/vendor/magento/module-customer/Model/AccountManagement.php b/vendor/magento/module-customer/Model/AccountManagement.php
19- index 6e0aac11d8e98..27c2bf4051ccc 100644
2+ index 6e0aac11d8e9..27c2bf4051cc 100644
203--- a/vendor/magento/module-customer/Model/AccountManagement.php
214+++ b/vendor/magento/module-customer/Model/AccountManagement.php
225@@ -876,11 +876,6 @@ public function getConfirmationStatus($customerId)
@@ -32,7 +15,7 @@ index 6e0aac11d8e98..27c2bf4051ccc 100644
3215 $this->checkPasswordStrength($password);
3316 $customerEmail = $customer->getEmail();
3417diff --git a/vendor/magento/module-customer/Model/AccountManagementApi.php b/vendor/magento/module-customer/Model/AccountManagementApi.php
35- index 02a05705b57ef..8b4f78ab26c77 100644
18+ index 02a05705b57e..8b4f78ab26c7 100644
3619--- a/vendor/magento/module-customer/Model/AccountManagementApi.php
3720+++ b/vendor/magento/module-customer/Model/AccountManagementApi.php
3821@@ -6,16 +6,127 @@
@@ -196,10 +179,10 @@ index 02a05705b57ef..8b4f78ab26c77 100644
196179 }
197180diff --git a/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php b/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
198181new file mode 100644
199- index 0000000000000..5b5c8ce1fc0ca
182+ index 000000000000..295b33d2db14
200183--- /dev/null
201184+++ b/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
202- @@ -0,0 +1,78 @@
185+ @@ -0,0 +1,89 @@
203186+ <?php
204187+ /**
205188+ * Copyright © Magento, Inc. All rights reserved.
@@ -211,7 +194,6 @@ index 0000000000000..5b5c8ce1fc0ca
211194+ namespace Magento\Customer\Plugin;
212195+
213196+ use Magento\Customer\Api\Data\CustomerInterface;
214- + use Magento\Framework\App\ObjectManager;
215197+ use Magento\Framework\AuthorizationInterface;
216198+ use Magento\Framework\Exception\AuthorizationException;
217199+ use Magento\AsynchronousOperations\Model\MassSchedule;
@@ -229,6 +211,13 @@ index 0000000000000..5b5c8ce1fc0ca
229211+ public const ADMIN_RESOURCE = 'Magento_Customer::manage';
230212+
231213+ /**
214+ + * account create topic name
215+ + *
216+ + * @var string
217+ + */
218+ + private const TOPIC_NAME = 'async.magento.customer.api.accountmanagementinterface.createaccount.post';
219+ +
220+ + /**
232221+ * @var AuthorizationInterface
233222+ */
234223+ private $authorization;
@@ -262,6 +251,11 @@ index 0000000000000..5b5c8ce1fc0ca
262251+ string $groupId = null,
263252+ string $userId = null
264253+ ) {
254+ + // only apply the plugin on account create.
255+ + if ($topic !== self::TOPIC_NAME) {
256+ + return;
257+ + }
258+ +
265259+ foreach ($entitiesArray as $entityParams) {
266260+ foreach ($entityParams as $entity) {
267261+ if ($entity instanceof CustomerInterface) {
@@ -280,7 +274,7 @@ index 0000000000000..5b5c8ce1fc0ca
280274+ }
281275diff --git a/vendor/magento/module-customer/Test/Unit/Model/AccountManagementApiTest.php b/vendor/magento/module-customer/Test/Unit/Model/AccountManagementApiTest.php
282276new file mode 100644
283- index 0000000000000..074d40021a184
277+ index 000000000000..074d40021a18
284278--- /dev/null
285279+++ b/vendor/magento/module-customer/Test/Unit/Model/AccountManagementApiTest.php
286280@@ -0,0 +1,421 @@
@@ -706,7 +700,7 @@ index 0000000000000..074d40021a184
706700+ }
707701+ }
708702diff --git a/vendor/magento/module-customer/Test/Unit/Model/AccountManagementTest.php b/vendor/magento/module-customer/Test/Unit/Model/AccountManagementTest.php
709- index 8ff6a8585212f..cbe0a18e4b178 100644
703+ index 8ff6a8585212..cbe0a18e4b17 100644
710704--- a/vendor/magento/module-customer/Test/Unit/Model/AccountManagementTest.php
711705+++ b/vendor/magento/module-customer/Test/Unit/Model/AccountManagementTest.php
712706@@ -1222,7 +1222,6 @@ public function testCreateAccountWithGroupId(): void
@@ -729,7 +723,7 @@ index 8ff6a8585212f..cbe0a18e4b178 100644
729723 ->willReturnOnConsecutiveCalls(null, $defaultGroupId);
730724diff --git a/vendor/magento/module-customer/Test/Unit/Plugin/AsyncRequestCustomerGroupAuthorizationTest.php b/vendor/magento/module-customer/Test/Unit/Plugin/AsyncRequestCustomerGroupAuthorizationTest.php
731725new file mode 100644
732- index 0000000000000..107df2c2863ef
726+ index 000000000000..107df2c2863e
733727--- /dev/null
734728+++ b/vendor/magento/module-customer/Test/Unit/Plugin/AsyncRequestCustomerGroupAuthorizationTest.php
735729@@ -0,0 +1,112 @@
@@ -846,7 +840,7 @@ index 0000000000000..107df2c2863ef
846840+ }
847841+ }
848842diff --git a/vendor/magento/module-customer/composer.json b/vendor/magento/module-customer/composer.json
849- index 2d76da56bff7d..ff34d423c2da5 100644
843+ index 2d76da56bff7..ff34d423c2da 100644
850844--- a/vendor/magento/module-customer/composer.json
851845+++ b/vendor/magento/module-customer/composer.json
852846@@ -29,5 +29,6 @@
@@ -858,7 +852,7 @@ index 2d76da56bff7d..ff34d423c2da5 100644
858852+ "magento/module-asynchronous-operations": "100.4.*"
859853 },
860854diff --git a/vendor/magento/module-customer/etc/di.xml b/vendor/magento/module-customer/etc/di.xml
861- index 156986b7b4a3c..120a8dda8aece 100644
855+ index 156986b7b4a3..120a8dda8aec 100644
862856--- a/vendor/magento/module-customer/etc/di.xml
863857+++ b/vendor/magento/module-customer/etc/di.xml
864858@@ -560,4 +560,9 @@
@@ -871,41 +865,8 @@ index 156986b7b4a3c..120a8dda8aece 100644
871865+ />
872866+ </type>
873867 </config>
874-
875-
876- ---
877- ...AsyncRequestCustomerGroupAuthorization.php | 6 +-
878- app/code/Magento/Quote/etc/webapi.xml | 3 +
879- .../Rest/Asynchronous/InputParamsResolver.php | 99 ++++++++++++++++++-
880- .../Quote/Api/GuestCartManagementTest.php | 2 +-
881- 4 files changed, 104 insertions(+), 6 deletions(-)
882-
883- diff --git a/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php b/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
884- index 5b5c8ce1fc0ca..0aa2b8bfb1d18 100644
885- --- a/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
886- +++ b/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
887- @@ -9,7 +9,6 @@
888- namespace Magento\Customer\Plugin;
889-
890- use Magento\Customer\Api\Data\CustomerInterface;
891- - use Magento\Framework\App\ObjectManager;
892- use Magento\Framework\AuthorizationInterface;
893- use Magento\Framework\Exception\AuthorizationException;
894- use Magento\AsynchronousOperations\Model\MassSchedule;
895- @@ -60,6 +59,11 @@ public function beforePublishMass(
896- string $groupId = null,
897- string $userId = null
898- ) {
899- + // only apply the plugin on account create.
900- + if ($topic !== 'async.magento.customer.api.accountmanagementinterface.createaccount.post') {
901- + return;
902- + }
903- +
904- foreach ($entitiesArray as $entityParams) {
905- foreach ($entityParams as $entity) {
906- if ($entity instanceof CustomerInterface) {
907868diff --git a/vendor/magento/module-quote/etc/webapi.xml b/vendor/magento/module-quote/etc/webapi.xml
908- index 79d98968ea198..a7cce5b03a26d 100644
869+ index 79d98968ea19..a7cce5b03a26 100644
909870--- a/vendor/magento/module-quote/etc/webapi.xml
910871+++ b/vendor/magento/module-quote/etc/webapi.xml
911872@@ -98,6 +98,9 @@
@@ -919,7 +880,7 @@ index 79d98968ea198..a7cce5b03a26d 100644
919880 <route url="/V1/guest-carts/:cartId/order" method="PUT">
920881 <service class="Magento\Quote\Api\GuestCartManagementInterface" method="placeOrder"/>
921882diff --git a/vendor/magento/module-webapi-async/Controller/Rest/Asynchronous/InputParamsResolver.php b/vendor/magento/module-webapi-async/Controller/Rest/Asynchronous/InputParamsResolver.php
922- index 8601e5011bda7..93555559ac9a1 100644
883+ index 8601e5011bda..93555559ac9a 100644
923884--- a/vendor/magento/module-webapi-async/Controller/Rest/Asynchronous/InputParamsResolver.php
924885+++ b/vendor/magento/module-webapi-async/Controller/Rest/Asynchronous/InputParamsResolver.php
925886@@ -8,10 +8,12 @@
@@ -1095,27 +1056,7 @@ index 8601e5011bda7..93555559ac9a1 100644
10951056+ }
10961057 }
10971058diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php
1098- index ce9e4ee941785..44533303c632d 100644
1099- --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php
1100- +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php
1101- @@ -339,7 +339,7 @@ public function testPlaceOrder()
1102- public function testAssignCustomerByGuestUser()
1103- {
1104- $this->expectException(\Exception::class);
1105- - $this->expectExceptionMessage('You don\'t have the correct permissions to assign the customer to the cart.');
1106- + $this->expectExceptionMessage('Enter and try again.');
1107-
1108- /** @var $quote \Magento\Quote\Model\Quote */
1109- $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class)->load('test01', 'reserved_order_id');
1110-
1111-
1112- ---
1113- .../Magento/Quote/Api/GuestCartManagementTest.php | 9 ++++++---
1114- .../Magento/Test/Php/_files/phpcpd/blacklist/common.txt | 1 +
1115- 2 files changed, 7 insertions(+), 3 deletions(-)
1116-
1117- diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php
1118- index 44533303c632d..e08fe0388cfbe 100644
1059+ index ce9e4ee94178..e08fe0388cfb 100644
11191060--- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php
11201061+++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php
11211062@@ -10,10 +10,13 @@
@@ -1135,45 +1076,21 @@ index 44533303c632d..e08fe0388cfbe 100644
11351076 protected $createdQuotes = [];
11361077
11371078 /**
1079+ @@ -339,7 +342,7 @@ public function testPlaceOrder()
1080+ public function testAssignCustomerByGuestUser()
1081+ {
1082+ $this->expectException(\Exception::class);
1083+ - $this->expectExceptionMessage('You don\'t have the correct permissions to assign the customer to the cart.');
1084+ + $this->expectExceptionMessage('Enter and try again.');
1085+
1086+ /** @var $quote \Magento\Quote\Model\Quote */
1087+ $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class)->load('test01', 'reserved_order_id');
11381088diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
1139- index efc7e669b3605..18ffe842c794c 100644
1089+ index efc7e669b360..18ffe842c794 100644
11401090--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
11411091+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
11421092@@ -109,3 +109,4 @@ app/code/Magento/Elasticsearch/Elasticsearch5/Model/Adapter/FieldMapper/Product/
11431093 app/code/Magento/Elasticsearch/Model/Layer/Search/ItemCollectionProvider.php
11441094 app/code/Magento/Newsletter/Model/Queue/TransportBuilder.php
11451095 app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/bulk.phtml
11461096+ app/code/Magento/WebapiAsync/Controller/Rest/Asynchronous/InputParamsResolver.php
1147-
1148-
1149- ---
1150- .../Plugin/AsyncRequestCustomerGroupAuthorization.php | 9 ++++++++-
1151- 1 file changed, 8 insertions(+), 1 deletion(-)
1152-
1153- diff --git a/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php b/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
1154- index 0aa2b8bfb1d18..295b33d2db14a 100644
1155- --- a/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
1156- +++ b/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
1157- @@ -25,6 +25,13 @@ class AsyncRequestCustomerGroupAuthorization
1158- */
1159- public const ADMIN_RESOURCE = 'Magento_Customer::manage';
1160-
1161- + /**
1162- + * account create topic name
1163- + *
1164- + * @var string
1165- + */
1166- + private const TOPIC_NAME = 'async.magento.customer.api.accountmanagementinterface.createaccount.post';
1167- +
1168- /**
1169- * @var AuthorizationInterface
1170- */
1171- @@ -60,7 +67,7 @@ public function beforePublishMass(
1172- string $userId = null
1173- ) {
1174- // only apply the plugin on account create.
1175- - if ($topic !== 'async.magento.customer.api.accountmanagementinterface.createaccount.post') {
1176- + if ($topic !== self::TOPIC_NAME) {
1177- return;
1178- }
1179-
0 commit comments