API: Rewrite queries for list=allusers
The existing query only works with a single value for augroup, or mostly
if it's combined with auprop=groups or auprop=rights (since most users
don't have every possible group).
When used with multiple values for augroup, it will raise an error if it
happens to encounter enough users who have more than one of the
specified groups. And further, it will lead to repeated groups for these
users if combined with auprop=groups or auprop=rights.
An attempt to use EXISTS instead of a JOIN to query user_groups failed
because it made the planner scan the user table where a smaller scan of
user_groups plus a filesort was faster. So instead, let's just fix it
directly by acknowledging that supplying multiple groups for
augroup is going to give us duplicate rows.
At the same time, let's try using a subquery (with GROUP_CONCAT) to
fetch the actual groups the user belongs to, both to avoid processing so
many duplicate rows and to simplify the row-processing code. And let's
kill the forced index, it's probably not needed anymore.
Bug: 70496
Change-Id: Ic87dbc3b2d933775ca71a72932e0658e2f082bb6