Fix blocking of Owner access right
Blocking the Owner access right on a parent project had no effect. Change-Id: Iba00e29fcf434da8a9263353e80b47d82caa8503 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -307,8 +307,9 @@ public class ProjectControl {
|
||||
|
||||
/** Is this user a project owner? Ownership does not imply {@link #isVisible()} */
|
||||
public boolean isOwner() {
|
||||
return isDeclaredOwner()
|
||||
|| user.getCapabilities().canAdministrateServer();
|
||||
return (isDeclaredOwner()
|
||||
&& !controlForRef("refs/*").isBlocked(Permission.OWNER))
|
||||
|| user.getCapabilities().canAdministrateServer();
|
||||
}
|
||||
|
||||
private boolean isDeclaredOwner() {
|
||||
|
||||
@@ -861,6 +861,14 @@ public class RefControlTest {
|
||||
assertCannotVote(2, range);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBlockOwner() {
|
||||
block(parent, OWNER, ANONYMOUS_USERS, "refs/*");
|
||||
allow(local, OWNER, DEVS, "refs/*");
|
||||
|
||||
assertThat(user(local, DEVS).isOwner()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateRefPatternsOK() throws Exception {
|
||||
RefPattern.validate("refs/*");
|
||||
|
||||
Reference in New Issue
Block a user