Consolidate user logins in webapi tests.
Many webapi tests needed to re-login with specific users, which may be
members of a LocalSite and/or admins.
This adds a _login_user function that takes parameters indicating whether the
user should be part of a local_site and/or whether they should be an admin.
It will determine the right user, potentially add it to the LocalSite's admin
lists, and log in. This reduces the amount of code in the tests and will be
used for the upcoming repository tests, which make extensive use of this.