PermissionRange: Interpret allowMin > allowMax as disallow
Set min and max to 0 if min > max. Bug: Issue 11059 Change-Id: I492ef61322dfb82273dc1ed1fe6ae86640541f11
This commit is contained in:
@@ -70,8 +70,8 @@ public class PermissionRange implements Comparable<PermissionRange> {
|
|||||||
this.min = min;
|
this.min = min;
|
||||||
this.max = max;
|
this.max = max;
|
||||||
} else {
|
} else {
|
||||||
this.min = max;
|
this.min = 0;
|
||||||
this.max = min;
|
this.max = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -584,6 +584,16 @@ public class RefControlTest {
|
|||||||
assertCannotUpdate("refs/tags/V10", u);
|
assertCannotUpdate("refs/tags/V10", u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void blockPartialRangeLocally() {
|
||||||
|
block(local, LABEL + "Code-Review", +1, +2, DEVS, "refs/heads/master");
|
||||||
|
|
||||||
|
ProjectControl u = user(local, DEVS);
|
||||||
|
|
||||||
|
PermissionRange range = u.controlForRef("refs/heads/master").getRange(LABEL + "Code-Review");
|
||||||
|
assertCannotVote(2, range);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void blockLabelRange_ParentBlocksChild() {
|
public void blockLabelRange_ParentBlocksChild() {
|
||||||
allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*");
|
allow(local, LABEL + "Code-Review", -2, +2, DEVS, "refs/heads/*");
|
||||||
|
|||||||
Reference in New Issue
Block a user