RefControl: Make project state checks in READ explicit
The majority of code in {Project,Ref,Change}Control is now about
permissions, but not all. Exceptions include checks for a project's
state. This is confusing, because users are presented with an exception
telling them that they lack some kind of permission while the real
reason for the failed operation is that the project's current state
doesn't permit the operation.
This is part of a series of commits to remove all project state checks
from *Control classes and make explicit checks instead.
Calls from resources in restapi/change/* need no explicit check if the
project state permits reads as this is checked in ChangesCollection.
Change-Id: I85836c102eadd33335f923c7a8f9aac97de4f654
This commit is contained in:
@@ -180,7 +180,8 @@ public class EventBroker implements EventDispatcher {
|
||||
if (pe == null) {
|
||||
return false;
|
||||
}
|
||||
return permissionBackend.user(user).ref(branchName).test(RefPermission.READ);
|
||||
return pe.statePermitsRead()
|
||||
&& permissionBackend.user(user).ref(branchName).test(RefPermission.READ);
|
||||
}
|
||||
|
||||
protected boolean isVisibleTo(Event event, CurrentUser user)
|
||||
|
||||
Reference in New Issue
Block a user