|
| 1 | +diff --git a/vendor/magento/module-company/Plugin/Checkout/Controller/Index/IndexPlugin.php b/vendor/magento/module-company/Plugin/Checkout/Controller/Index/IndexPlugin.php |
| 2 | +index 98c1cb41e4b0..c12ef88b9213 100644 |
| 3 | +--- a/vendor/magento/module-company/Plugin/Checkout/Controller/Index/IndexPlugin.php |
| 4 | ++++ b/vendor/magento/module-company/Plugin/Checkout/Controller/Index/IndexPlugin.php |
| 5 | +@@ -38,14 +38,14 @@ class IndexPlugin |
| 6 | + private $request; |
| 7 | + |
| 8 | + /** |
| 9 | +- * @var \Magento\Company\Api\AuthorizationInterface |
| 10 | ++ * @var \Magento\Company\Model\CompanyUserPermission |
| 11 | + */ |
| 12 | +- private $authorization; |
| 13 | ++ private $companyUserPermission; |
| 14 | + |
| 15 | + /** |
| 16 | +- * @var \Magento\Company\Model\CompanyUserPermission |
| 17 | ++ * @var \Magento\Customer\Model\Session |
| 18 | + */ |
| 19 | +- private $companyUserPermission; |
| 20 | ++ private $customerSession; |
| 21 | + |
| 22 | + /** |
| 23 | + * @param \Magento\Authorization\Model\UserContextInterface $userContext |
| 24 | +@@ -53,8 +53,8 @@ class IndexPlugin |
| 25 | + * @param \Magento\Company\Model\Customer\PermissionInterface $permission |
| 26 | + * @param \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory |
| 27 | + * @param \Magento\Framework\App\RequestInterface $request |
| 28 | +- * @param \Magento\Company\Api\AuthorizationInterface $authorization |
| 29 | + * @param \Magento\Company\Model\CompanyUserPermission $companyUserPermission |
| 30 | ++ * @param \Magento\Customer\Model\Session $customerSession |
| 31 | + */ |
| 32 | + public function __construct( |
| 33 | + \Magento\Authorization\Model\UserContextInterface $userContext, |
| 34 | +@@ -62,16 +62,16 @@ public function __construct( |
| 35 | + \Magento\Company\Model\Customer\PermissionInterface $permission, |
| 36 | + \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory, |
| 37 | + \Magento\Framework\App\RequestInterface $request, |
| 38 | +- \Magento\Company\Api\AuthorizationInterface $authorization, |
| 39 | +- \Magento\Company\Model\CompanyUserPermission $companyUserPermission |
| 40 | ++ \Magento\Company\Model\CompanyUserPermission $companyUserPermission, |
| 41 | ++ \Magento\Customer\Model\Session $customerSession |
| 42 | + ) { |
| 43 | + $this->userContext = $userContext; |
| 44 | + $this->customerRepository = $customerRepository; |
| 45 | + $this->permission = $permission; |
| 46 | + $this->resultRedirectFactory = $resultRedirectFactory; |
| 47 | + $this->request = $request; |
| 48 | +- $this->authorization = $authorization; |
| 49 | + $this->companyUserPermission = $companyUserPermission; |
| 50 | ++ $this->customerSession = $customerSession; |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | +@@ -90,6 +90,9 @@ public function aroundExecute( |
| 55 | + ) { |
| 56 | + $customerId = $this->userContext->getUserId(); |
| 57 | + if ($customerId) { |
| 58 | ++ if (!$this->customerSession->isLoggedIn()) { |
| 59 | ++ return $this->resultRedirectFactory->create()->setPath('customer/account/login'); |
| 60 | ++ } |
| 61 | + $customer = $this->customerRepository->getById($customerId); |
| 62 | + $isNegotiableQuoteActive = (bool) $this->request->getParam('negotiableQuoteId'); |
| 63 | + if (!$this->permission->isCheckoutAllowed($customer, $isNegotiableQuoteActive)) { |
0 commit comments