Merge branch 'stable-3.1'

* stable-3.1:
  Fix Access when the only readable ref is a RegExp with a gerrit pattern
  e2e-tests: Mention http credentials in documentation
  Fix refPattern when using username/shardeduserid pattern with regexp
  Enable optional DEBUG level logs for query tests

Change-Id: Ia713e8dba63c0ddf69fb138cdc0f83d7839ba863
This commit is contained in:
David Pursehouse
2020-02-14 09:31:49 +09:00
14 changed files with 146 additions and 7 deletions

View File

@@ -15,6 +15,7 @@
package com.google.gerrit.server.permissions;
import static com.google.gerrit.common.data.PermissionRule.Action.BLOCK;
import static com.google.gerrit.server.project.RefPattern.containsParameters;
import static com.google.gerrit.server.project.RefPattern.isRE;
import static java.util.stream.Collectors.mapping;
import static java.util.stream.Collectors.toList;
@@ -131,7 +132,9 @@ public class PermissionCollection {
Iterable<SectionMatcher> matcherList, String ref, CurrentUser user) {
try (Timer0.Context ignored = filterLatency.start()) {
if (isRE(ref)) {
ref = RefPattern.shortestExample(ref);
if (!containsParameters(ref)) {
ref = RefPattern.shortestExample(ref);
}
} else if (ref.endsWith("/*")) {
ref = ref.substring(0, ref.length() - 1);
}