Make project state check in CREATE_CHANGE 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 also adds intermediary checks for project state to ChangeControl to keep the individual changes small. These will be removed in subsequent commits. Change-Id: I6db9c5e7ecf5d4f7b18bb5446522651236798e12
This commit is contained in:
@@ -1521,6 +1521,10 @@ class ReceiveCommits {
|
||||
reject(cmd, denied.getMessage());
|
||||
return;
|
||||
}
|
||||
if (!projectState.statePermitsWrite()) {
|
||||
reject(cmd, "project state does not permit write");
|
||||
return;
|
||||
}
|
||||
|
||||
if (magicBranch.isPrivate && magicBranch.removePrivate) {
|
||||
reject(cmd, "the options 'private' and 'remove-private' are mutually exclusive");
|
||||
|
Reference in New Issue
Block a user