From c84a9d4aa6ad2f87b70a2e87f4454d3de3b5e475 Mon Sep 17 00:00:00 2001 From: Joost van Driel Date: Tue, 8 Nov 2022 18:34:38 +0100 Subject: [PATCH] Loosen type check for user, to handle more types of users --- src/Security/Voter/InvoiceVoter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Security/Voter/InvoiceVoter.php b/src/Security/Voter/InvoiceVoter.php index 794a0cb8..34f6e5c0 100644 --- a/src/Security/Voter/InvoiceVoter.php +++ b/src/Security/Voter/InvoiceVoter.php @@ -15,8 +15,8 @@ use Sylius\Component\Core\Model\AdminUserInterface; use Sylius\Component\Core\Model\CustomerInterface; -use Sylius\Component\Core\Model\ShopUserInterface; use Sylius\Component\Core\Repository\OrderRepositoryInterface; +use Sylius\Component\Customer\Model\CustomerAwareInterface; use Sylius\Component\User\Model\UserInterface; use Sylius\InvoicingPlugin\Entity\InvoiceInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; @@ -73,7 +73,7 @@ private function canAccess(UserInterface $user, InvoiceInterface $invoice): bool return true; } - if ($user instanceof ShopUserInterface) { + if ($user instanceof CustomerAwareInterface) { $customer = $user->getCustomer(); Assert::isInstanceOf($customer, CustomerInterface::class);