The code used union selects; left joins at least are easier to read. In
some places it was also not so clear that the WHERE part for the
disabled column really worked.
The query FIND_GROUP_USERS also needs to take the disabled column in to
account.
Signed-off-by: Claus-Justus Heine <himself@claus-justus-heine.de>
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>