Skip to content

Commit b39421d

Browse files
committed
Selecting and counting users from the User-Group table needs DISTINCT to avoid duplicates.
In particular when using the catch-all group ("Default Group" setting) the queries which count and select users from the User-Group table need the "DISTINCT" option: the catch-all group is replaced by a '%' wild-card in the query. As users may belong by design to more than one group counting and selecting users comes out wrong. Even worse: the many duplicates interfere with the paging logic of the user admin-settings. Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
1 parent b1819aa commit b39421d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Query/QueryProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ private function loadQueries()
135135
"AND g.$gAdmin",
136136

137137
Query::COUNT_GROUPS =>
138-
"SELECT COUNT(ug.$ugGID) " .
138+
"SELECT COUNT(DISTINCT ug.$ugUID) " .
139139
"FROM $userGroup ug " .
140140
"WHERE ug.$ugGID LIKE :$gidParam " .
141141
"AND ug.$ugUID LIKE :$searchParam",
@@ -152,7 +152,7 @@ private function loadQueries()
152152
"WHERE g.$gGID = :$gidParam",
153153

154154
Query::FIND_GROUP_USERS =>
155-
"SELECT ug.$ugUID AS uid " .
155+
"SELECT DISTINCT ug.$ugUID AS uid " .
156156
"FROM $userGroup ug " .
157157
"WHERE ug.$ugGID LIKE :$gidParam " .
158158
"AND ug.$ugUID LIKE :$searchParam " .

0 commit comments

Comments
 (0)