Submodule ACLs: inherit them from the parent project.
This allows easy server wide configuration, one could imagine having
the following lines in the project.config of All-Projects, which any
project inherits from:
[allowSuperproject "my-only-superproject"]
refs = refs/heads/*:refs/heads/*
Change-Id: If90ef2b0132e567cff7e06aa5a3ecf1b38b6db0e
This commit is contained in:
@@ -17,6 +17,7 @@ package com.google.gerrit.acceptance.git;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import com.google.gerrit.acceptance.AbstractDaemonTest;
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.common.data.Permission;
|
||||
import com.google.gerrit.common.data.SubscribeSection;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
@@ -35,14 +36,19 @@ import org.eclipse.jgit.transport.RefSpec;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public abstract class AbstractSubmoduleSubscription extends AbstractDaemonTest {
|
||||
protected TestRepository<?> createProjectWithPush(String name)
|
||||
throws Exception {
|
||||
Project.NameKey project = createProject(name);
|
||||
protected TestRepository<?> createProjectWithPush(String name,
|
||||
@Nullable Project.NameKey parent) throws Exception {
|
||||
Project.NameKey project = createProject(name, parent);
|
||||
grant(Permission.PUSH, project, "refs/heads/*");
|
||||
grant(Permission.SUBMIT, project, "refs/for/refs/heads/*");
|
||||
return cloneProject(project);
|
||||
}
|
||||
|
||||
protected TestRepository<?> createProjectWithPush(String name)
|
||||
throws Exception {
|
||||
return createProjectWithPush(name, null);
|
||||
}
|
||||
|
||||
private static AtomicInteger contentCounter = new AtomicInteger(0);
|
||||
|
||||
protected ObjectId pushChangeTo(TestRepository<?> repo, String ref,
|
||||
|
||||
@@ -19,6 +19,7 @@ import static com.google.common.truth.Truth.assertThat;
|
||||
import com.google.gerrit.acceptance.GerritConfig;
|
||||
import com.google.gerrit.acceptance.NoHttpd;
|
||||
import com.google.gerrit.testutil.ConfigSuite;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
|
||||
import org.eclipse.jgit.junit.TestRepository;
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
@@ -311,6 +312,23 @@ public class SubmoduleSubscriptionsIT extends AbstractSubmoduleSubscription {
|
||||
assertThat(hasSubmodule(superRepo, "master", "subscribed-to-project")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSubscriptionInheritACL() throws Exception {
|
||||
createProjectWithPush("config-repo");
|
||||
TestRepository<?> superRepo = createProjectWithPush("super-project",
|
||||
new Project.NameKey(name("config-repo")));
|
||||
TestRepository<?> subRepo = createProjectWithPush("subscribed-to-project");
|
||||
allowSubmoduleSubscription("config-repo", "refs/heads/master",
|
||||
"super-project", "refs/heads/wrong-branch");
|
||||
|
||||
pushChangeTo(subRepo, "master");
|
||||
createSubmoduleSubscription(superRepo, "master",
|
||||
"subscribed-to-project", "master");
|
||||
pushChangeTo(subRepo, "master");
|
||||
assertThat(hasSubmodule(superRepo, "master",
|
||||
"subscribed-to-project")).isFalse();
|
||||
}
|
||||
|
||||
private void deleteAllSubscriptions(TestRepository<?> repo, String branch)
|
||||
throws Exception {
|
||||
repo.git().fetch().setRemote("origin").call();
|
||||
|
||||
Reference in New Issue
Block a user