Sync CREATE_GROUP permission from All-Projects to All-Users

For groups in NoteDb, we manage group ownership through permissions on
the group ref. During the migration, we need to sync the global
capability CREATE_GROUP from All-Projects to a ref permission on
refs/groups/* in All-Users.

This commit adds this syncing for changes made in the REST API, RPCs and
in direct Git commits and adds tests for the syncing via the REST API.

Change-Id: Ic12bb782380ae30e4ebd892adc3c50154934df81
This commit is contained in:
Patrick Hiesel
2017-11-07 15:50:08 +01:00
parent 219cf5a375
commit 6235216491
8 changed files with 196 additions and 2 deletions

View File

@@ -72,6 +72,7 @@ import com.google.gerrit.server.AnonymousUser;
import com.google.gerrit.server.ApprovalsUtil;
import com.google.gerrit.server.ChangeFinder;
import com.google.gerrit.server.CmdLineParserModule;
import com.google.gerrit.server.CreateGroupPermissionSyncer;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.PluginUser;
import com.google.gerrit.server.Sequences;
@@ -315,6 +316,10 @@ public class GerritGlobalModule extends FactoryModule {
DynamicSet.setOf(binder(), CommentAddedListener.class);
DynamicSet.setOf(binder(), HashtagsEditedListener.class);
DynamicSet.setOf(binder(), ChangeMergedListener.class);
bind(ChangeMergedListener.class)
.annotatedWith(Exports.named("CreateGroupPermissionSyncer"))
.to(CreateGroupPermissionSyncer.class);
DynamicSet.setOf(binder(), ChangeRestoredListener.class);
DynamicSet.setOf(binder(), ChangeRevertedListener.class);
DynamicSet.setOf(binder(), ReviewerAddedListener.class);