Make project state check 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: Ifde8885cf48d7a63af52fe5ce3347f880f131d48
This commit is contained in:
@@ -92,11 +92,12 @@ public class ChangeArgumentParser {
|
||||
if (!changes.containsKey(notes.getChangeId())
|
||||
&& inProject(projectState, notes.getProjectName())
|
||||
&& (canMaintainServer
|
||||
|| permissionBackend
|
||||
.user(currentUser)
|
||||
.change(notes)
|
||||
.database(db)
|
||||
.test(ChangePermission.READ))) {
|
||||
|| (permissionBackend
|
||||
.user(currentUser)
|
||||
.change(notes)
|
||||
.database(db)
|
||||
.test(ChangePermission.READ)
|
||||
&& projectState.statePermitsRead()))) {
|
||||
toAdd.add(notes);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user