Make project state check in SUBMIT 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.

This commit changes the behavior of SUBMIT permission checks on
refs/meta/config. Previously, owners would pass this check while it now
fails for them. This is sane given that there is a proven way of making
a project active again (see ProjectIT#nonActiveProjectCanBeMadeActive).

Change-Id: I3b9a8fd0d2ee8789ada46dec025d0a96276a6bbe
This commit is contained in:
Patrick Hiesel
2018-01-12 11:31:28 +01:00
parent 0ca8c722a3
commit a5850fa89c
3 changed files with 20 additions and 2 deletions

View File

@@ -1550,6 +1550,10 @@ class ReceiveCommits {
reject(cmd, e.getMessage());
return;
}
if (!projectState.statePermitsWrite()) {
reject(cmd, "project state does not permit write");
return;
}
}
RevWalk walk = rp.getRevWalk();