Cleanup callers of PermissionBackend#user()

This commit moves callers of PermissionBackend#user() to call
PermissionBackend#currentUser() in cases where the user for the
previous call could only come from the Injector and where we don't
already need a CurrentUser object in the class.

It migrates callers that explicitly check permissions of absent users to
call PermissionBackend#absentUser().

In cases where we check permissions of absent users that could also be
unauthenticated, checks for anonymous users are made explicitly.

Change-Id: I6b470790e89b69077650fed42cb61dfeeb404b6e
This commit is contained in:
Patrick Hiesel
2018-04-24 13:41:48 +02:00
parent 9ed6325da1
commit 70870059cd
18 changed files with 65 additions and 75 deletions

View File

@@ -123,7 +123,7 @@ public class EqualsLabelPredicate extends ChangeIndexPredicate {
// Check the user has 'READ' permission.
try {
PermissionBackend.ForChange perm =
permissionBackend.user(reviewer).database(dbProvider).change(cd);
permissionBackend.absentUser(approver).database(dbProvider).change(cd);
ProjectState projectState = projectCache.checkedGet(cd.project());
return projectState != null
&& projectState.statePermitsRead()