Allow replication of hidden projects

When replicateHiddenProjects is set to true, the replication
task should be scheduled even if the project state does not
allow reads.

Also document that projects and project_list cache TTL needs to
be kept to a minimum, for allowing the results of the replication
to be effective on the system.

With regards to the REST-APIs (apply-object/fetch) document that
the pull replication user needs to be added as the OWNER of the
projects for being able to unhide through replication.

Bug: Issue 291876050
Change-Id: Iaa65b58b98fa05570a06b4c31ed204e864fda826
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java
index 42ecfe1..c903656 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/Source.java
@@ -319,13 +319,6 @@
                         ref);
                     throw new NoSuchProjectException(project);
                   }
-                  if (!projectState.get().statePermitsRead()) {
-                    repLog.warn(
-                        "NOT scheduling replication {}:{} because project is not readable",
-                        project,
-                        ref);
-                    return false;
-                  }
                   if (!shouldReplicate(projectState.get(), userProvider.get())) {
                     return false;
                   }
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md
index 22b52e7..73c5c05 100644
--- a/src/main/resources/Documentation/about.md
+++ b/src/main/resources/Documentation/about.md
@@ -16,6 +16,10 @@
 group that is granted the 'Pull Replication' capability (provided
 by this plugin) or the 'Administrate Server' capability.
 
+When replicating hidden projects, the pull replication user needs to have
+the 'Administrate Server' capability or being added as the owner of each
+individual project that is supposed to be replicated.
+
 Change Indexing
 --------
 
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
index b85aeb6..65b03b8 100644
--- a/src/main/resources/Documentation/config.md
+++ b/src/main/resources/Documentation/config.md
@@ -80,6 +80,21 @@
 
 	Default is 1024.
 
+cache.projects.refreshAfterWrite
+:	The Gerrit configuration of the `projects` cache, as [documented](/Documentation/config-gerrit.html#cache.name.refreshAfterWrite)
+
+	Needs to be set to a relatively low value (e.g. 1 min) for allowing the
+	project settings cache to be kept relatively up-to-date (e.g. within 1 mins)
+	with the incoming replication tasks updating it.
+
+cache.project_list.refreshAfterWrite
+:	The Gerrit configuration of the `project_list` cache, as [documented](/Documentation/config-gerrit.html#cache.name.refreshAfterWrite)
+
+	Needs to be set to a relatively low value (e.g. 5 min) for allowing the
+	creation, removal and hiding of projects performed by incoming
+	replication tasks to be reflected relavitely soon (e.g. within 5 mins)
+	in the list of projects.
+
 File `@PLUGIN@.config`
 -------------------------