src/Aqarmap/Bundle/ListingBundle/Security/Authorization/Voter/OwnerVoter.php line 10
<?phpnamespace Aqarmap\Bundle\ListingBundle\Security\Authorization\Voter;use Aqarmap\Bundle\ListingBundle\Security\Authorization\OwnerInterface;use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;use Symfony\Component\Security\Core\Authorization\Voter\Voter;use Symfony\Component\Security\Core\User\UserInterface;class OwnerVoter extends Voter{protected function voteOnAttribute($attribute, $subject, TokenInterface $token): bool{$user = $token->getUser();if (!$user instanceof UserInterface) {return false;}// Verifies that the user is the owner$listingOwner = $subject->getUser();if ($listingOwner->getId() === $user->getId() || ($user->getChildren() && $user->getChildren()->contains($listingOwner))) {return true;}return false;}public function supports($attribute, $subject): bool{return 'ROLE_OWNER' === $attribute && $subject instanceof OwnerInterface;}}