Move permission filtering for All-Projects from ProjectState to ProjectConfig

Certain permissions cannot be used in All-Projects and are filtered
out before we evaluate them. This used to be done in ProjectState
and was cached when that entity was cached. Now, we cache immutable
data objects (mostly AutoValues) for better thread safety.

When the ProjectCache was refactored, this logic was left in
ProjectState. This means it has to be recomputed quite often when
permissions are evaluated. A recent profile showed that we can
save CPU time (hence request time) as well as heap if we cache
the outcome of this filtering.

This is what this commit does. Existing tests check that permissions
that are not allowed on All-Projects (e.g. OWNERS on refs/*) are
indeed not evaluated.

Since this filtering depends on if a project is considered to
be All-Projects or not, we have to invalidate the cache when
the name of All-Projects changes. We document this fact.

Change-Id: I01e08e70bf36aaf4be522564286ab4a86e7681a3
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index a1dc27c..ace6995 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -2216,6 +2216,9 @@
 other project managed by the running server. The name is
 relative to `gerrit.basePath`.
 +
+The link:#cache_names[persisted_projects cache] must be
+flushed after this setting is changed.
++
 Defaults to `All-Projects` if not set.
 
 [[gerrit.defaultBranch]]gerrit.defaultBranch::