Add project config boolean to require signed push on a project

This is controlled by receive.requireSignedPush in the project.config,
which is a separate bit from receive.enableSignedPush. (Adding an
inheritable tri-state enum would have been complex to implement and
have hard-to-define semantics.)

requireSignedPush is only inspected if enableSignedPush is true; this
allows project owners to temporarily disable signed push entirely e.g.
due to a bug, without having to flip both bits.

Change-Id: I07999b6fa185d470b30509941473e3158f9dfa2c
This commit is contained in:
Dave Borowitz
2015-10-20 10:35:26 -04:00
parent ff473bb345
commit 0543c735eb
14 changed files with 117 additions and 11 deletions

View File

@@ -70,6 +70,7 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
public InheritableBoolean createNewChangeForAllNotInTarget;
public InheritableBoolean requireChangeId;
public InheritableBoolean enableSignedPush;
public InheritableBoolean requireSignedPush;
public String maxObjectSizeLimit;
public SubmitType submitType;
public com.google.gerrit.extensions.client.ProjectState state;
@@ -166,8 +167,13 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
p.setRequireChangeID(input.requireChangeId);
}
if (input.enableSignedPush != null) {
p.setEnableSignedPush(input.enableSignedPush);
if (serverEnableSignedPush) {
if (input.enableSignedPush != null) {
p.setEnableSignedPush(input.enableSignedPush);
}
if (input.requireSignedPush != null) {
p.setRequireSignedPush(input.requireSignedPush);
}
}
if (input.maxObjectSizeLimit != null) {