Remove getDB and hasAuthorization #3437
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Best viewed by individual commit.
getDB
was deprecated a while ago, when we addedRequestContext
. We left it for a bit to make sure we had the right interface forRequestContext
. It seems to be working well, so now we can remove it.We had 3 different ways to authorize a request (
hasAuthorization
,RequireInfraRole
, andCan
which was recently renamed toIsAuthorized
). We've been replacing the use ofhasAuthorization
with a check in the caller to compare the requested ID to the authorized user. This PR replaces the last few callers to use the pattern we have in other place. It also changesisIdentitySelf
to accept aRequestContext
and remove the error return (since it always returnednil
). This reduces the number of ways to authorize a request to 2. We should be able to reduce it to a single function in the future.