Skip to content

Commit c17449a

Browse files
committed
Product should be assigned to option while option is assigned to product.
1 parent ddee804 commit c17449a

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

app/code/Magento/Customer/Model/Plugin/CustomerAuthorization.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Authorization\Model\UserContextInterface;
1010
use Magento\Customer\Model\CustomerFactory;
11+
use Magento\Customer\Model\ResourceModel\Customer as CustomerResource;
1112
use Magento\Integration\Api\AuthorizationServiceInterface as AuthorizationService;
1213
use Magento\Store\Model\StoreManagerInterface;
1314

@@ -24,29 +25,37 @@ class CustomerAuthorization
2425
private $userContext;
2526

2627
/**
27-
* @var StoreManagerInterface
28+
* @var CustomerFactory
2829
*/
29-
private $storeManager;
30+
private $customerFactory;
3031

3132
/**
32-
* @var CustomerFactory
33+
* @var CustomerResource
3334
*/
34-
private $customerFactory;
35+
private $customerResource;
36+
37+
/**
38+
* @var StoreManagerInterface
39+
*/
40+
private $storeManager;
3541

3642
/**
3743
* Inject dependencies.
3844
*
3945
* @param UserContextInterface $userContext
4046
* @param CustomerFactory $customerFactory
47+
* @param CustomerResource $customerResource
4148
* @param StoreManagerInterface $storeManager
4249
*/
4350
public function __construct(
4451
UserContextInterface $userContext,
4552
CustomerFactory $customerFactory,
53+
CustomerResource $customerResource,
4654
StoreManagerInterface $storeManager
4755
) {
4856
$this->userContext = $userContext;
4957
$this->customerFactory = $customerFactory;
58+
$this->customerResource = $customerResource;
5059
$this->storeManager = $storeManager;
5160
}
5261

@@ -72,7 +81,8 @@ public function aroundIsAllowed(
7281
&& $this->userContext->getUserId()
7382
&& $this->userContext->getUserType() === UserContextInterface::USER_TYPE_CUSTOMER
7483
) {
75-
$customer = $this->customerFactory->create()->load($this->userContext->getUserId());
84+
$customer = $this->customerFactory->create();
85+
$this->customerResource->load($customer, $this->userContext->getUserId());
7686
$currentStoreId = $this->storeManager->getStore()->getId();
7787
$sharedStoreIds = $customer->getSharedStoreIds();
7888
if (in_array($currentStoreId, $sharedStoreIds)) {

dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerSharingOptionsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class CustomerSharingOptionsTest extends WebapiAbstract
6060
/**
6161
* Execute per test initialization.
6262
*/
63-
public function setUp()
63+
public function setUp(): void
6464
{
6565
$this->customerRegistry = Bootstrap::getObjectManager()->get(
6666
\Magento\Customer\Model\CustomerRegistry::class
@@ -82,7 +82,7 @@ public function setUp()
8282
/**
8383
* Ensure that fixture customer and his addresses are deleted.
8484
*/
85-
public function tearDown()
85+
public function tearDown(): void
8686
{
8787
$this->customerRepository = null;
8888

0 commit comments

Comments
 (0)