Allow admins to index a change even if the branch is not Readable for them
The ChangesCollection rejects the request if the current user doesn't have the
Read permission on the loaded change. Therefore, an attempt to reindex a change:
PUT /changes/myProject~12345/index
gets rejected even before it reaches the indexing code.
On the other side, the admin can reindex all changes of that project and thus
also index the change 12345:
POST /projects/myProject/index.changes
Indexing all changes of a project in order to just index one change is too much.
Add a new REST endpoint where a set of change-ids to index is given in the
request body.
POST /config/server/index.changes
Content-Type: application/json; charset=UTF-8
{changes: ["foo~101", "bar~202"]}
Bug: issue 11205
Change-Id: I05fcc5a024c7634a969a7baac9fd61f3d0f3d12a
diff --git a/Documentation/rest-api-config.txt b/Documentation/rest-api-config.txt
index 3ec989e..7be8c32 100644
--- a/Documentation/rest-api-config.txt
+++ b/Documentation/rest-api-config.txt
@@ -1376,6 +1376,28 @@
}
----
+[[index.changes]]
+=== Index a set of changes
+
+This endpoint allows Gerrit admins to index a set of changes with one request
+by providing a link:#index-changes-input[IndexChangesInput] entity.
+
+Using this endpoint Gerrit admins can also index change(s) which are not visible to them.
+
+.Request
+----
+ POST /config/server/index.changes HTTP/1.0
+ Content-Type: application/json; charset=UTF-8
+
+ {changes: ["foo~101", "bar~202"]}
+----
+
+.Response
+----
+ HTTP/1.1 200 OK
+ Content-Disposition: attachment
+----
+
[[ids]]
== IDs
@@ -1825,6 +1847,17 @@
Only set for disk caches.
|==================================
+[[index-changes-input]]
+=== IndexChangesInput
+The `IndexChangesInput` contains a list of numerical changes IDs to index.
+
+[options="header",cols="1,^2,4"]
+|================================
+|Field Name ||Description
+|`changes` ||
+List of link:rest-api-changes.html#change-id[change-ids]
+|================================
+
[[jvm-summary-info]]
=== JvmSummaryInfo
The `JvmSummaryInfo` entity contains information about the JVM.