Fix userrights-interwiki when the 'user' table is shared

At present, this function selects the user table from the same DB as the
user_groups, however, in wikifarms this is not often the case, as the user
table is often shared, but the user_groups table not. Adding a check in
here, and passing the shared table, if needed, ONLY to the user query,
should fix.

Change-Id: Ib85630067c402b8e4f50ff11a33fe7f0eadd4f16