diff --git a/vendor/magento/module-company/Plugin/Checkout/Controller/Index/IndexPlugin.php b/vendor/magento/module-company/Plugin/Checkout/Controller/Index/IndexPlugin.php index 98c1cb41e4b0..c12ef88b9213 100644 --- a/vendor/magento/module-company/Plugin/Checkout/Controller/Index/IndexPlugin.php +++ b/vendor/magento/module-company/Plugin/Checkout/Controller/Index/IndexPlugin.php @@ -38,14 +38,14 @@ class IndexPlugin private $request; /** - * @var \Magento\Company\Api\AuthorizationInterface + * @var \Magento\Company\Model\CompanyUserPermission */ - private $authorization; + private $companyUserPermission; /** - * @var \Magento\Company\Model\CompanyUserPermission + * @var \Magento\Customer\Model\Session */ - private $companyUserPermission; + private $customerSession; /** * @param \Magento\Authorization\Model\UserContextInterface $userContext @@ -53,8 +53,8 @@ class IndexPlugin * @param \Magento\Company\Model\Customer\PermissionInterface $permission * @param \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory * @param \Magento\Framework\App\RequestInterface $request - * @param \Magento\Company\Api\AuthorizationInterface $authorization * @param \Magento\Company\Model\CompanyUserPermission $companyUserPermission + * @param \Magento\Customer\Model\Session $customerSession */ public function __construct( \Magento\Authorization\Model\UserContextInterface $userContext, @@ -62,16 +62,16 @@ public function __construct( \Magento\Company\Model\Customer\PermissionInterface $permission, \Magento\Framework\Controller\Result\RedirectFactory $resultRedirectFactory, \Magento\Framework\App\RequestInterface $request, - \Magento\Company\Api\AuthorizationInterface $authorization, - \Magento\Company\Model\CompanyUserPermission $companyUserPermission + \Magento\Company\Model\CompanyUserPermission $companyUserPermission, + \Magento\Customer\Model\Session $customerSession ) { $this->userContext = $userContext; $this->customerRepository = $customerRepository; $this->permission = $permission; $this->resultRedirectFactory = $resultRedirectFactory; $this->request = $request; - $this->authorization = $authorization; $this->companyUserPermission = $companyUserPermission; + $this->customerSession = $customerSession; } /** @@ -90,6 +90,9 @@ public function aroundExecute( ) { $customerId = $this->userContext->getUserId(); if ($customerId) { + if (!$this->customerSession->isLoggedIn()) { + return $this->resultRedirectFactory->create()->setPath('customer/account/login'); + } $customer = $this->customerRepository->getById($customerId); $isNegotiableQuoteActive = (bool) $this->request->getParam('negotiableQuoteId'); if (!$this->permission->isCheckoutAllowed($customer, $isNegotiableQuoteActive)) {