diff --git a/Form/Type/ScopePickerType.php b/Form/Type/ScopePickerType.php index 9525e81f0..dbbc28255 100644 --- a/Form/Type/ScopePickerType.php +++ b/Form/Type/ScopePickerType.php @@ -113,6 +113,9 @@ class ScopePickerType extends AbstractType */ protected function buildAccessibleScopeQuery(Center $center, Role $role) { + $roles = $this->authorizationHelper->getParentRoles($role); + $roles[] = $role; + $qb = $this->scopeRepository->createQueryBuilder('s'); $qb // jointure to center @@ -128,7 +131,7 @@ class ScopePickerType extends AbstractType function(Role $role) { return $role->getRole(); }, - $this->authorizationHelper->getParentRoles($role) + $roles )) // user contraint ->andWhere(':user MEMBER OF gc.users') diff --git a/Form/Type/UserPickerType.php b/Form/Type/UserPickerType.php index fd7600bf9..a9a0bf62e 100644 --- a/Form/Type/UserPickerType.php +++ b/Form/Type/UserPickerType.php @@ -88,6 +88,9 @@ class UserPickerType extends AbstractType return $u->getUsername(); }) ->setNormalizer('query_builder', function(Options $options) { + $roles = $this->authorizationHelper->getParentRoles($options['role']); + $roles[] = $options['role']; + $qb = $this->userRepository->createQueryBuilder('u'); $qb // add center constraint @@ -103,7 +106,7 @@ class UserPickerType extends AbstractType 'roles', \array_map( function(Role $role) { return $role->getRole(); }, - $this->authorizationHelper->getParentRoles($options['role']) + $roles ) ) // add active constraint