mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-27 18:13:48 +00:00
add UserPickerType
This commit is contained in:
@@ -25,6 +25,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Symfony\Component\Security\Core\Role\RoleHierarchyInterface;
|
||||
use Symfony\Component\Security\Core\Role\Role;
|
||||
|
||||
|
||||
/**
|
||||
@@ -96,8 +98,14 @@ class UserPickerType extends AbstractType
|
||||
->join('ug.permissionsGroup', 'pg')
|
||||
// role constraints
|
||||
->join('pg.roleScopes', 'roleScope')
|
||||
->andWhere($qb->expr()->eq('roleScope.role', ':role'))
|
||||
->setParameter('role', $options['role'])
|
||||
->andWhere($qb->expr()->in('roleScope.role', ':roles'))
|
||||
->setParameter(
|
||||
'roles',
|
||||
\array_map(
|
||||
function(Role $role) { return $role->getRole(); },
|
||||
$this->authorizationHelper->getParentRoles($options['role'])
|
||||
)
|
||||
)
|
||||
// add active constraint
|
||||
->andWhere('u.enabled = :enabled')
|
||||
->setParameter('enabled', true)
|
||||
|
Reference in New Issue
Block a user