<?php
namespace App\Security\Voter\Permissions\Admin;
use Symfony\Component\Security\Core\User\UserInterface;
class AdminContractVoter extends AdminVoter
{
protected function getUserProfiles(UserInterface $user, string $entityId): array
{
$heimdallUser = $this->userManager->findUser($user->getUsername());
$userProfiles = $this->userProfileManager->getUserProfiles($heimdallUser);
return array_filter(
$userProfiles,
fn ($userProfile) => in_array($entityId, $userProfile->getContracts()) || !empty($userProfile->getPortals())
);
}
}