summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Milanesio <luca.milanesio@gmail.com>2020-11-19 00:22:24 +0000
committerLuca Milanesio <luca.milanesio@gmail.com>2020-11-19 22:13:50 +0000
commit047263d258b96cbb7e3e91ce13730f478d8878a4 (patch)
treed109719d14d5d5a463d78cab1edeb7fc8d954c0f
parentf4da11a04a358bf62c48186490db60c810b7b4fb (diff)
parenta57f872df00f0f2d5f6484a11473de0d2a7297bc (diff)
Merge branch 'stable-2.14-2020-11.notedb-refs-tags' into stable-2.14
* stable-2.14-2020-11.notedb-refs-tags: Set version to 2.14.22 Workaround Gitiles bug on All-Users visibility Validate Gerrit changes on stable-2.15 with Jenkins Also, set target version to 2.14.23-SNAPSHOT. Change-Id: I400d374a5950c95d9abfedc8a6ff07a6b4864b66
-rw-r--r--Jenkinsfile1
-rw-r--r--gerrit-acceptance-framework/pom.xml2
-rw-r--r--gerrit-extension-api/pom.xml2
-rw-r--r--gerrit-plugin-api/pom.xml2
-rw-r--r--gerrit-plugin-gwtui/pom.xml2
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectControl.java8
-rw-r--r--gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java35
-rw-r--r--gerrit-war/pom.xml2
-rw-r--r--version.bzl2
9 files changed, 48 insertions, 8 deletions
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000000..565dd45586
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1 @@
+gerritPipeline()
diff --git a/gerrit-acceptance-framework/pom.xml b/gerrit-acceptance-framework/pom.xml
index 9e5a073e58..be1e177c54 100644
--- a/gerrit-acceptance-framework/pom.xml
+++ b/gerrit-acceptance-framework/pom.xml
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-acceptance-framework</artifactId>
- <version>2.14.22-SNAPSHOT</version>
+ <version>2.14.23-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Gerrit Code Review - Acceptance Test Framework</name>
<description>Framework for Gerrit's acceptance tests</description>
diff --git a/gerrit-extension-api/pom.xml b/gerrit-extension-api/pom.xml
index eb41098678..d1e940e5d3 100644
--- a/gerrit-extension-api/pom.xml
+++ b/gerrit-extension-api/pom.xml
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-extension-api</artifactId>
- <version>2.14.22-SNAPSHOT</version>
+ <version>2.14.23-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Gerrit Code Review - Extension API</name>
<description>API for Gerrit Extensions</description>
diff --git a/gerrit-plugin-api/pom.xml b/gerrit-plugin-api/pom.xml
index b1f16a7fac..1abf2d8453 100644
--- a/gerrit-plugin-api/pom.xml
+++ b/gerrit-plugin-api/pom.xml
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-api</artifactId>
- <version>2.14.22-SNAPSHOT</version>
+ <version>2.14.23-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Gerrit Code Review - Plugin API</name>
<description>API for Gerrit Plugins</description>
diff --git a/gerrit-plugin-gwtui/pom.xml b/gerrit-plugin-gwtui/pom.xml
index 544741e219..93b74e90a2 100644
--- a/gerrit-plugin-gwtui/pom.xml
+++ b/gerrit-plugin-gwtui/pom.xml
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-gwtui</artifactId>
- <version>2.14.22-SNAPSHOT</version>
+ <version>2.14.23-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Gerrit Code Review - Plugin GWT UI</name>
<description>Common Classes for Gerrit GWT UI Plugins</description>
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectControl.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectControl.java
index fefc84d73d..1b035b95b8 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectControl.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectControl.java
@@ -39,6 +39,7 @@ import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.account.GroupMembership;
import com.google.gerrit.server.change.IncludedInResolver;
+import com.google.gerrit.server.config.AllUsersName;
import com.google.gerrit.server.config.CanonicalWebUrl;
import com.google.gerrit.server.config.GitReceivePackGroups;
import com.google.gerrit.server.config.GitUploadPackGroups;
@@ -171,6 +172,7 @@ public class ProjectControl {
@Nullable private final SearchingChangeCacheImpl changeCache;
private final Provider<InternalChangeQuery> queryProvider;
private final Metrics metrics;
+ private final AllUsersName allUsersName;
private List<SectionMatcher> allSections;
private List<SectionMatcher> localSections;
@@ -190,6 +192,7 @@ public class ProjectControl {
Provider<InternalChangeQuery> queryProvider,
@Nullable SearchingChangeCacheImpl changeCache,
@CanonicalWebUrl @Nullable String canonicalWebUrl,
+ AllUsersName allUsersName,
@Assisted CurrentUser who,
@Assisted ProjectState ps,
Metrics metrics) {
@@ -204,6 +207,7 @@ public class ProjectControl {
this.canonicalWebUrl = canonicalWebUrl;
this.queryProvider = queryProvider;
this.metrics = metrics;
+ this.allUsersName = allUsersName;
user = who;
state = ps;
}
@@ -318,7 +322,9 @@ public class ProjectControl {
}
public boolean allRefsAreVisible(Set<String> ignore) {
- return user.isInternalUser() || canPerformOnAllRefs(Permission.READ, ignore);
+ return user.isInternalUser()
+ || (!getProject().getNameKey().equals(allUsersName)
+ && canPerformOnAllRefs(Permission.READ, ignore));
}
/** Is this user a project owner? Ownership does not imply {@link #isVisible()} */
diff --git a/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java b/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java
index 4f2284cb40..0c3d4c28e9 100644
--- a/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java
+++ b/gerrit-server/src/test/java/com/google/gerrit/server/project/RefControlTest.java
@@ -114,6 +114,14 @@ public class RefControlTest {
assertThat(u.isVisible()).named("can read").isTrue();
}
+ private void assertAllRefsAreVisible(ProjectControl u) {
+ assertThat(u.allRefsAreVisible()).named("all refs visible").isTrue();
+ }
+
+ private void assertAllRefsAreNotVisible(ProjectControl u) {
+ assertThat(u.allRefsAreVisible()).named("all refs NOT visible").isFalse();
+ }
+
private void assertCannotRead(ProjectControl u) {
assertThat(u.isVisible()).named("cannot read").isFalse();
}
@@ -189,6 +197,7 @@ public class RefControlTest {
private final Map<Project.NameKey, ProjectState> all = new HashMap<>();
private Project.NameKey localKey = new Project.NameKey("local");
private ProjectConfig local;
+ private ProjectConfig allUsers;
private Project.NameKey parentKey = new Project.NameKey("parent");
private ProjectConfig parent;
private InMemoryRepositoryManager repoManager;
@@ -219,7 +228,7 @@ public class RefControlTest {
@Override
public ProjectState getAllUsers() {
- return null;
+ return get(allUsersName);
}
@Override
@@ -273,6 +282,11 @@ public class RefControlTest {
LabelType cr = Util.codeReview();
allProjects.getLabelSections().put(cr.getName(), cr);
add(allProjects);
+
+ Repository allUsersRepo = repoManager.createRepository(allUsersName);
+ allUsers = new ProjectConfig(new Project.NameKey(allUsersName.get()));
+ allUsers.load(allUsersRepo);
+ add(allUsers);
} catch (IOException | ConfigInvalidException e) {
throw new RuntimeException(e);
}
@@ -347,6 +361,24 @@ public class RefControlTest {
}
@Test
+ public void allRefsAreVisibleForRegularProject() throws Exception {
+ allow(local, READ, DEVS, "refs/*");
+ allow(local, READ, DEVS, "refs/groups/*");
+ allow(local, READ, DEVS, "refs/users/default");
+
+ assertAllRefsAreVisible(user(local, DEVS));
+ }
+
+ @Test
+ public void allRefsAreNotVisibleForAllUsers() throws Exception {
+ allow(allUsers, READ, DEVS, "refs/*");
+ allow(allUsers, READ, DEVS, "refs/groups/*");
+ allow(allUsers, READ, DEVS, "refs/users/default");
+
+ assertAllRefsAreNotVisible(user(allUsers, DEVS));
+ }
+
+ @Test
public void branchDelegation1() {
allow(local, OWNER, ADMIN, "refs/*");
allow(local, OWNER, DEVS, "refs/heads/x/*");
@@ -908,6 +940,7 @@ public class RefControlTest {
queryProvider,
null,
canonicalWebUrl,
+ allUsersName,
new MockUser(name, memberOf),
newProjectState(local),
metrics);
diff --git a/gerrit-war/pom.xml b/gerrit-war/pom.xml
index 98f9012ecb..c885b1d38e 100644
--- a/gerrit-war/pom.xml
+++ b/gerrit-war/pom.xml
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-war</artifactId>
- <version>2.14.22-SNAPSHOT</version>
+ <version>2.14.23-SNAPSHOT</version>
<packaging>war</packaging>
<name>Gerrit Code Review - WAR</name>
<description>Gerrit WAR</description>
diff --git a/version.bzl b/version.bzl
index 530373867a..30a5f0ed36 100644
--- a/version.bzl
+++ b/version.bzl
@@ -2,4 +2,4 @@
# Used by :api_install and :api_deploy targets
# when talking to the destination repository.
#
-GERRIT_VERSION = "2.14.22-SNAPSHOT"
+GERRIT_VERSION = "2.14.23-SNAPSHOT"