Skip to content

Commit

Permalink
minor #299 Loosen type check for user, to handle more types of users …
Browse files Browse the repository at this point in the history
…(j92)

This PR was merged into the main branch.

Discussion
----------

See issue: #298

Commits
-------

c84a9d4 Loosen type check for user, to handle more types of users
  • Loading branch information
GSadee authored Feb 21, 2023
2 parents 7f21793 + c84a9d4 commit ac4ce31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Security/Voter/InvoiceVoter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ac4ce31

Please sign in to comment.