Reject %wip/%ready from non-owners of change
When a user who is not the owner of a change pushes a new patch set to that change, prevent them from modifying the WIP state of the change. Bug: Issue 6596 Change-Id: I4931d9cea634eedec09ba75f458e8383756d3560
This commit is contained in:
@@ -202,6 +202,9 @@ public class ReceiveCommits {
|
||||
+ "Squash the commits with the same Change-Id or "
|
||||
+ "ensure Change-Ids are unique for each commit";
|
||||
|
||||
public static final String ONLY_OWNER_CAN_MODIFY_WIP =
|
||||
"only change owner can modify Work-in-Progress";
|
||||
|
||||
private enum Error {
|
||||
CONFIG_UPDATE(
|
||||
"You are not allowed to perform this operation.\n"
|
||||
@@ -2484,6 +2487,14 @@ public class ReceiveCommits {
|
||||
}
|
||||
}
|
||||
|
||||
if (magicBranch != null
|
||||
&& (magicBranch.workInProgress || magicBranch.ready)
|
||||
&& magicBranch.workInProgress != change.isWorkInProgress()
|
||||
&& !user.getAccountId().equals(change.getOwner())) {
|
||||
reject(inputCommand, ONLY_OWNER_CAN_MODIFY_WIP);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (magicBranch != null && magicBranch.edit) {
|
||||
return newEdit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user