userContext = $userContext; } /** * {@inheritdoc} */ public function isAllowed(CartInterface $quote): bool { switch ($this->userContext->getUserType()) { case UserContextInterface::USER_TYPE_CUSTOMER: $isAllowed = ($quote->getCustomerId() == $this->userContext->getUserId()); break; case UserContextInterface::USER_TYPE_GUEST: $isAllowed = ($quote->getCustomerId() === null); break; case UserContextInterface::USER_TYPE_ADMIN: case UserContextInterface::USER_TYPE_INTEGRATION: $isAllowed = true; break; default: $isAllowed = false; } return $isAllowed; } }