Skip to content
This repository was archived by the owner on May 20, 2019. It is now read-only.

Commit 1acda9b

Browse files
author
Volodymyr Kublytskyi
committed
#14: The user passed for async api should reference WebAPI user
- applied backward compatibility policy to modified constructors
1 parent 614ed8a commit 1acda9b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\AsynchronousOperations\Model;
77

8+
use Magento\Framework\App\ObjectManager;
89
use Magento\Framework\App\ResourceConnection;
910
use Magento\AsynchronousOperations\Api\Data\BulkSummaryInterface;
1011
use Magento\AsynchronousOperations\Api\Data\BulkSummaryInterfaceFactory;
@@ -71,6 +72,7 @@ class BulkManagement implements \Magento\Framework\Bulk\BulkManagementInterface
7172
* @param MetadataPool $metadataPool
7273
* @param ResourceConnection $resourceConnection
7374
* @param \Psr\Log\LoggerInterface $logger
75+
* @param UserContextInterface $userContext
7476
*/
7577
public function __construct(
7678
EntityManager $entityManager,
@@ -79,17 +81,17 @@ public function __construct(
7981
BulkPublisherInterface $publisher,
8082
MetadataPool $metadataPool,
8183
ResourceConnection $resourceConnection,
82-
UserContextInterface $userContext,
83-
\Psr\Log\LoggerInterface $logger
84+
\Psr\Log\LoggerInterface $logger,
85+
UserContextInterface $userContext = null
8486
) {
8587
$this->entityManager = $entityManager;
8688
$this->bulkSummaryFactory= $bulkSummaryFactory;
8789
$this->operationCollectionFactory = $operationCollectionFactory;
8890
$this->metadataPool = $metadataPool;
8991
$this->resourceConnection = $resourceConnection;
9092
$this->publisher = $publisher;
91-
$this->userContext = $userContext;
9293
$this->logger = $logger;
94+
$this->userContext = $userContext ?: ObjectManager::getInstance()->get(UserContextInterface::class);
9395
}
9496

9597
/**

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

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

99
namespace Magento\AsynchronousOperations\Model;
1010

11+
use Magento\Framework\App\ObjectManager;
1112
use Magento\Framework\DataObject\IdentityGeneratorInterface;
1213
use Magento\Framework\Exception\LocalizedException;
1314
use Magento\AsynchronousOperations\Api\Data\ItemStatusInterfaceFactory;
@@ -69,6 +70,7 @@ class MassSchedule
6970
* @param BulkManagementInterface $bulkManagement
7071
* @param LoggerInterface $logger
7172
* @param OperationRepository $operationRepository
73+
* @param UserContextInterface $userContext
7274
*/
7375
public function __construct(
7476
IdentityGeneratorInterface $identityService,
@@ -77,15 +79,15 @@ public function __construct(
7779
BulkManagementInterface $bulkManagement,
7880
LoggerInterface $logger,
7981
OperationRepository $operationRepository,
80-
UserContextInterface $userContext
82+
UserContextInterface $userContext = null
8183
) {
8284
$this->identityService = $identityService;
8385
$this->itemStatusInterfaceFactory = $itemStatusInterfaceFactory;
8486
$this->asyncResponseFactory = $asyncResponseFactory;
8587
$this->bulkManagement = $bulkManagement;
8688
$this->logger = $logger;
8789
$this->operationRepository = $operationRepository;
88-
$this->userContext = $userContext;
90+
$this->userContext = $userContext ?: ObjectManager::getInstance()->get(UserContextInterface::class);
8991
}
9092

9193
/**

0 commit comments

Comments
 (0)