From 35154f5ae17c975f4261be6df1aa0e31285069ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 3 Nov 2021 15:33:03 +0100 Subject: [PATCH] fix constructor into acl aware repository --- .../Repository/UserACLAwareRepository.php | 12 ++++++++++-- .../Security/Authorization/AuthorizationHelper.php | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) 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); } /**