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
-
18
1
diff --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
20
3
--- a/vendor/magento/module-customer/Model/AccountManagement.php
21
4
+++ b/vendor/magento/module-customer/Model/AccountManagement.php
22
5
@@ -876,11 +876,6 @@ public function getConfirmationStatus($customerId)
@@ -32,7 +15,7 @@ index 6e0aac11d8e98..27c2bf4051ccc 100644
32
15
$this->checkPasswordStrength($password);
33
16
$customerEmail = $customer->getEmail();
34
17
diff --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
36
19
--- a/vendor/magento/module-customer/Model/AccountManagementApi.php
37
20
+++ b/vendor/magento/module-customer/Model/AccountManagementApi.php
38
21
@@ -6,16 +6,127 @@
@@ -196,10 +179,10 @@ index 02a05705b57ef..8b4f78ab26c77 100644
196
179
}
197
180
diff --git a/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php b/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
198
181
new file mode 100644
199
- index 0000000000000..5b5c8ce1fc0ca
182
+ index 000000000000..295b33d2db14
200
183
--- /dev/null
201
184
+++ b/vendor/magento/module-customer/Plugin/AsyncRequestCustomerGroupAuthorization.php
202
- @@ -0,0 +1,78 @@
185
+ @@ -0,0 +1,89 @@
203
186
+ <?php
204
187
+ /**
205
188
+ * Copyright © Magento, Inc. All rights reserved.
@@ -211,7 +194,6 @@ index 0000000000000..5b5c8ce1fc0ca
211
194
+ namespace Magento\Customer\Plugin;
212
195
+
213
196
+ use Magento\Customer\Api\Data\CustomerInterface;
214
- + use Magento\Framework\App\ObjectManager;
215
197
+ use Magento\Framework\AuthorizationInterface;
216
198
+ use Magento\Framework\Exception\AuthorizationException;
217
199
+ use Magento\AsynchronousOperations\Model\MassSchedule;
@@ -229,6 +211,13 @@ index 0000000000000..5b5c8ce1fc0ca
229
211
+ public const ADMIN_RESOURCE = 'Magento_Customer::manage';
230
212
+
231
213
+ /**
214
+ + * account create topic name
215
+ + *
216
+ + * @var string
217
+ + */
218
+ + private const TOPIC_NAME = 'async.magento.customer.api.accountmanagementinterface.createaccount.post';
219
+ +
220
+ + /**
232
221
+ * @var AuthorizationInterface
233
222
+ */
234
223
+ private $authorization;
@@ -262,6 +251,11 @@ index 0000000000000..5b5c8ce1fc0ca
262
251
+ string $groupId = null,
263
252
+ string $userId = null
264
253
+ ) {
254
+ + // only apply the plugin on account create.
255
+ + if ($topic !== self::TOPIC_NAME) {
256
+ + return;
257
+ + }
258
+ +
265
259
+ foreach ($entitiesArray as $entityParams) {
266
260
+ foreach ($entityParams as $entity) {
267
261
+ if ($entity instanceof CustomerInterface) {
@@ -280,7 +274,7 @@ index 0000000000000..5b5c8ce1fc0ca
280
274
+ }
281
275
diff --git a/vendor/magento/module-customer/Test/Unit/Model/AccountManagementApiTest.php b/vendor/magento/module-customer/Test/Unit/Model/AccountManagementApiTest.php
282
276
new file mode 100644
283
- index 0000000000000..074d40021a184
277
+ index 000000000000..074d40021a18
284
278
--- /dev/null
285
279
+++ b/vendor/magento/module-customer/Test/Unit/Model/AccountManagementApiTest.php
286
280
@@ -0,0 +1,421 @@
@@ -706,7 +700,7 @@ index 0000000000000..074d40021a184
706
700
+ }
707
701
+ }
708
702
diff --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
710
704
--- a/vendor/magento/module-customer/Test/Unit/Model/AccountManagementTest.php
711
705
+++ b/vendor/magento/module-customer/Test/Unit/Model/AccountManagementTest.php
712
706
@@ -1222,7 +1222,6 @@ public function testCreateAccountWithGroupId(): void
@@ -729,7 +723,7 @@ index 8ff6a8585212f..cbe0a18e4b178 100644
729
723
->willReturnOnConsecutiveCalls(null, $defaultGroupId);
730
724
diff --git a/vendor/magento/module-customer/Test/Unit/Plugin/AsyncRequestCustomerGroupAuthorizationTest.php b/vendor/magento/module-customer/Test/Unit/Plugin/AsyncRequestCustomerGroupAuthorizationTest.php
731
725
new file mode 100644
732
- index 0000000000000..107df2c2863ef
726
+ index 000000000000..107df2c2863e
733
727
--- /dev/null
734
728
+++ b/vendor/magento/module-customer/Test/Unit/Plugin/AsyncRequestCustomerGroupAuthorizationTest.php
735
729
@@ -0,0 +1,112 @@
@@ -846,7 +840,7 @@ index 0000000000000..107df2c2863ef
846
840
+ }
847
841
+ }
848
842
diff --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
850
844
--- a/vendor/magento/module-customer/composer.json
851
845
+++ b/vendor/magento/module-customer/composer.json
852
846
@@ -29,5 +29,6 @@
@@ -858,7 +852,7 @@ index 2d76da56bff7d..ff34d423c2da5 100644
858
852
+ "magento/module-asynchronous-operations": "100.4.*"
859
853
},
860
854
diff --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
862
856
--- a/vendor/magento/module-customer/etc/di.xml
863
857
+++ b/vendor/magento/module-customer/etc/di.xml
864
858
@@ -560,4 +560,9 @@
@@ -871,41 +865,8 @@ index 156986b7b4a3c..120a8dda8aece 100644
871
865
+ />
872
866
+ </type>
873
867
</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) {
907
868
diff --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
909
870
--- a/vendor/magento/module-quote/etc/webapi.xml
910
871
+++ b/vendor/magento/module-quote/etc/webapi.xml
911
872
@@ -98,6 +98,9 @@
@@ -919,7 +880,7 @@ index 79d98968ea198..a7cce5b03a26d 100644
919
880
<route url="/V1/guest-carts/:cartId/order" method="PUT">
920
881
<service class="Magento\Quote\Api\GuestCartManagementInterface" method="placeOrder"/>
921
882
diff --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
923
884
--- a/vendor/magento/module-webapi-async/Controller/Rest/Asynchronous/InputParamsResolver.php
924
885
+++ b/vendor/magento/module-webapi-async/Controller/Rest/Asynchronous/InputParamsResolver.php
925
886
@@ -8,10 +8,12 @@
@@ -1095,27 +1056,7 @@ index 8601e5011bda7..93555559ac9a1 100644
1095
1056
+ }
1096
1057
}
1097
1058
diff --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
1119
1060
--- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php
1120
1061
+++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php
1121
1062
@@ -10,10 +10,13 @@
@@ -1135,45 +1076,21 @@ index 44533303c632d..e08fe0388cfbe 100644
1135
1076
protected $createdQuotes = [];
1136
1077
1137
1078
/**
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');
1138
1088
diff --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
1140
1090
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
1141
1091
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
1142
1092
@@ -109,3 +109,4 @@ app/code/Magento/Elasticsearch/Elasticsearch5/Model/Adapter/FieldMapper/Product/
1143
1093
app/code/Magento/Elasticsearch/Model/Layer/Search/ItemCollectionProvider.php
1144
1094
app/code/Magento/Newsletter/Model/Queue/TransportBuilder.php
1145
1095
app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/bulk.phtml
1146
1096
+ 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