Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AccessValidator.php
Go to the documentation of this file.
1 <?php
8 
13 {
17  private $userContext;
18 
22  private $entityManager;
23 
27  private $bulkSummaryFactory;
28 
35  public function __construct(
36  \Magento\Authorization\Model\UserContextInterface $userContext,
37  \Magento\Framework\EntityManager\EntityManager $entityManager,
38  \Magento\AsynchronousOperations\Api\Data\BulkSummaryInterfaceFactory $bulkSummaryFactory
39  ) {
40  $this->userContext = $userContext;
41  $this->entityManager = $entityManager;
42  $this->bulkSummaryFactory = $bulkSummaryFactory;
43  }
44 
51  public function isAllowed($bulkUuid)
52  {
54  $bulkSummary = $this->entityManager->load(
55  $this->bulkSummaryFactory->create(),
56  $bulkUuid
57  );
58  return $bulkSummary->getUserId() === $this->userContext->getUserId();
59  }
60 }
__construct(\Magento\Authorization\Model\UserContextInterface $userContext, \Magento\Framework\EntityManager\EntityManager $entityManager, \Magento\AsynchronousOperations\Api\Data\BulkSummaryInterfaceFactory $bulkSummaryFactory)