diff --git a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php index 44399000b..de0ded2c2 100644 --- a/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/UserACLAwareRepository.php @@ -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(); diff --git a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php index f075b650f..03adbdbc9 100644 --- a/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php +++ b/src/Bundle/ChillMainBundle/Security/Authorization/AuthorizationHelper.php @@ -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); } /**