fix: leave house managers who are also team admins or travel managers out of house manager mail

This commit is contained in:
fromme committed 2026-11-12 14:16:21 +01:00
1 parent f22d1f1199
commit 50ef662dd3
3 files changed
+29 -1

No files matched your search

+7
View File
@@ -126,6 +126,9 @@ class UserRepository extends ServiceEntityRepository
* to them (a blocked account cannot log in to do what it is reminded of) and an assignment
* mailing puts them in CC. Hotel codes and muted notifications are the caller's to check.
*
* Left out is a house manager who is also a team admin or travel manager: staff hold the role
* and hotel codes for testing, and BusPro syncs both on every login, so they cannot be removed.
*
* @return User[]
*/
public function findActiveHouseManagers(): array
@@ -134,9 +137,13 @@ class UserRepository extends ServiceEntityRepository
return $qb
->where('JSON_CONTAINS(user.roles, :role) = 1')
->andWhere('JSON_CONTAINS(user.roles, :teamAdmin) = 0')
->andWhere('JSON_CONTAINS(user.roles, :manager) = 0')
->andWhere($qb->expr()->isNull('user.deletedAt'))
->andWhere($qb->expr()->isNull('user.disabledAt'))
->setParameter('role', json_encode('ROLE_HOUSE_MANAGER'))
->setParameter('teamAdmin', json_encode('ROLE_TEAM_ADMIN'))
->setParameter('manager', json_encode('ROLE_MANAGER'))
->orderBy('user.id')
->getQuery()
->getResult()
@@ -44,7 +44,8 @@ class AssignmentMailingService
* rule that gives them access to the house's teamers) is in CC on exactly one mail: that of
* the first recipient confirmed on an assignment of their house, in the recipients' order.
* Muted notifications do not count, this is no notification. Left out is a house manager who
* gets the mailing anyway, as one of the teamers or under one of their addresses.
* gets the mailing anyway, as one of the teamers or under one of their addresses, and a test
* account, see UserRepository::findActiveHouseManagers().
*
* @return array<int, User[]> teamer id => house managers
*/