<?php
namespace App\Security\Voter\Permissions\User;
use App\Manager\OrganizationManagerInterface;
use App\Manager\UserManagerInterface;
class UserOrganizationVoter extends UserVoter
{
protected OrganizationManagerInterface $organizationManager;
public function __construct(OrganizationManagerInterface $organizationManager, UserManagerInterface $userManager)
{
parent::__construct($userManager);
$this->organizationManager = $organizationManager;
}
protected function getEntities(string $userId)
{
list($organizations) = $this->organizationManager->getOrganizationsByUser($userId);
return $organizations;
}
}