Use AccountResolver2 to resolve strings to IdentifiedUsers

In many callers, this allows us to remove special error handling code:
problems will propagate as UnprocessableEntityExceptions with helpful
messages. The main exception is in AccountsCollection, which is used to
parse users out of URLs (as opposed to, say, JSON inputs). In this case
the correct behavior is to wrap the exception in
ResourceNotFoundException, or AuthException in the case of "self".

The one place that gets more ugly is ReviewerAdder, where we need to
propagate the exception message for a NOT_FOUND result and combine that
with the hard-coded error message when a group is missing. This produces
a somewhat unnecessarily verbose message. The idea is that this
AccountResolver series is a prerequisite for rewriting ReviewerAdder,
which will reduce this ugliness.

Change-Id: I99c03df3da853cba7958bc027d0f67a0320c9e5a
This commit is contained in:
Dave Borowitz
2019-01-23 17:02:11 -08:00
parent 5b5ee594b8
commit b920f3f407
16 changed files with 161 additions and 102 deletions

View File

@@ -1,9 +1,7 @@
revertChangeDefaultMessage = Revert \"{0}\"\n\nThis reverts commit {1}.
reviewerCantSeeChange = {0} does not have permission to see this change
reviewerInactive = {0} identifies an inactive account
reviewerInvalid = {0} is not a valid user identifier
reviewerNotFoundUser = {0} does not identify a registered user
reviewerNotFoundUserOrGroup = {0} does not identify a registered user or group
groupIsNotAllowed = The group {0} cannot be added as reviewer.