handle hidden users in teams (#1841)

* allow to add disabled users to team
* allow to include disabled users in user-select
* include disabled users when editing team members ONLY if they are already part of team
This commit is contained in:
Kevin Papst
2020-07-26 13:13:06 +02:00
committed by GitHub
parent ecea92942c
commit 130e6ac057
9 changed files with 99 additions and 15 deletions

View File

@@ -141,8 +141,22 @@ class UserRepository extends EntityRepository implements UserLoaderInterface
{
$qb = $this->createQueryBuilder('u');
$qb->andWhere($qb->expr()->eq('u.enabled', ':enabled'));
$qb->setParameter('enabled', true, \PDO::PARAM_BOOL);
$or = $qb->expr()->orX();
if ($query->isShowVisible()) {
$or->add($qb->expr()->eq('u.enabled', ':enabled'));
$qb->setParameter('enabled', true, \PDO::PARAM_BOOL);
}
$includeAlways = $query->getUsersAlwaysIncluded();
if (!empty($includeAlways)) {
$or->add($qb->expr()->in('u', ':users'));
$qb->setParameter('users', $includeAlways);
}
if ($or->count() > 0) {
$qb->andWhere($or);
}
$qb->orderBy('u.username', 'ASC');