In I7710befa I didn't realize the user provider was a
Provider<IdentifiedUser>, which caused a ProvisionException when
anonymous users tried to use the REST API to look up changes by
something other than a number. This wasn't noticed sooner because it
didn't affect the web UI, which exclusively uses change numbers.
Change to Provider<CurrentUser> and use asIdentifiedUser only at the
sites where an IdentifiedUser is needed. This will throw a different
unchecked exception type on failure (UnsupportedOperationException
instead of ProvisionException), but callers aren't depending on that.
Add a test, during which I also discovered a bug in the implementation
of AbstractDaemonTest#setApiUserAnonymous. That wasn't already causing
failures because the only user was using it to avoid some side effects
that "may" have happened.
Change-Id: Idbad114d6f5a61167d6fda32ee0093558491cf8e