Merge branch 'stable-3.1' into stable-3.2

* stable-3.1:
  Split integration tests to different targets
  Don't check read permission when authgroup isn't set

Change-Id: Ic5c8f0468869476a01923b4d374f0188c271daf2
diff --git a/BUILD b/BUILD
index 9fb9a49..ba4a21d 100644
--- a/BUILD
+++ b/BUILD
@@ -33,18 +33,16 @@
     ],
 )
 
-junit_tests(
-    name = "replication_it",
-    srcs = glob([
-        "src/test/java/**/*IT.java",
-    ]),
+[junit_tests(
+    name = f[:f.index(".")].replace("/", "_"),
+    srcs = [f],
     tags = ["replication"],
     visibility = ["//visibility:public"],
     deps = PLUGIN_TEST_DEPS + PLUGIN_DEPS + [
         ":replication__plugin",
         ":replication_util",
     ],
-)
+) for f in glob(["src/test/java/**/*IT.java"])]
 
 java_library(
     name = "replication_util",
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
index 793bb5b..67dae7e 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/Destination.java
@@ -335,6 +335,9 @@
                 if (PushOne.ALL_REFS.equals(ref)) {
                   return true;
                 }
+                if (userProvider.get().isInternalUser()) {
+                  return true;
+                }
                 try {
                   permissionBackend
                       .user(userProvider.get())