fix constructor into acl aware repository

This commit is contained in:
Julien Fastré 2021-11-03 15:33:03 +01:00
parent 6911ace412
commit 35154f5ae1
2 changed files with 12 additions and 3 deletions

View File

@ -6,15 +6,23 @@ use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Scope;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\MainBundle\Security\ParentRoleHelper;
use Doctrine\ORM\EntityManagerInterface;
class UserACLAwareRepository implements UserACLAwareRepositoryInterface
{
private ParentRoleHelper $parentRoleHelper;
private EntityManagerInterface $em;
private AuthorizationHelper $authorizationHelper;
public function __construct(ParentRoleHelper $parentRoleHelper, EntityManagerInterface $em)
{
$this->parentRoleHelper = $parentRoleHelper;
$this->em = $em;
}
public function findUsersByReachedACL(string $role, $center, $scope = null, bool $onlyEnabled = true): array
{
$parents = $this->authorizationHelper->getParentRoles($role);
$parents = $this->parentRoleHelper->getParentRoles($role);
$parents[] = $role;
$qb = $this->em->createQueryBuilder();

View File

@ -321,7 +321,8 @@ class AuthorizationHelper implements AuthorizationHelperInterface
*/
public function findUsersReaching(string $role, $center, $scope = null, bool $onlyEnabled = true): array
{
return $this->userACLAwareRepository->findUsersByReachedACL($role, $center, $scope, $onlyEnabled);
return $this->userACLAwareRepository
->findUsersByReachedACL($role, $center, $scope, $onlyEnabled);
}
/**