use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class GroupsUpdateIT method groupRenameIsRetriedWhenFailedDueToConcurrentNameModification.
@Test
public void groupRenameIsRetriedWhenFailedDueToConcurrentNameModification() throws Exception {
createGroup("users", "users-UUID");
GroupDelta groupDelta = GroupDelta.builder().setName(AccountGroup.nameKey("contributors")).setMemberModification(new CreateAnotherGroupOnceAsSideEffectOfMemberModification("verifiers")).build();
updateGroup(AccountGroup.uuid("users-UUID"), groupDelta);
Stream<String> allGroupNames = getAllGroupNames();
assertThat(allGroupNames).containsAtLeast("contributors", "verifiers");
}
use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class DeleteMembers method removeGroupMembers.
private void removeGroupMembers(AccountGroup.UUID groupUuid, Set<Account.Id> accountIds) throws IOException, NoSuchGroupException, ConfigInvalidException {
GroupDelta groupDelta = GroupDelta.builder().setMemberModification(memberIds -> Sets.difference(memberIds, accountIds)).build();
groupsUpdateProvider.get().updateGroup(groupUuid, groupDelta);
}
use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class SchemaCreatorImpl method createBatchUsersGroup.
private void createBatchUsersGroup(Sequences seqs, Repository allUsersRepo, GroupReference groupReference, AccountGroup.UUID adminsGroupUuid) throws IOException, ConfigInvalidException {
InternalGroupCreation groupCreation = getGroupCreation(seqs, groupReference);
GroupDelta groupDelta = GroupDelta.builder().setDescription("Users who perform batch actions on Gerrit").setOwnerGroupUUID(adminsGroupUuid).build();
createGroup(allUsersRepo, groupCreation, groupDelta);
}
use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class AccountManager method addGroupMember.
private void addGroupMember(AccountGroup.UUID groupUuid, IdentifiedUser user) throws IOException, ConfigInvalidException, AccountException {
// The user initiated this request by logging in. -> Attribute all modifications to that user.
GroupsUpdate groupsUpdate = groupsUpdateFactory.create(user);
GroupDelta groupDelta = GroupDelta.builder().setMemberModification(memberIds -> Sets.union(memberIds, ImmutableSet.of(user.getAccountId()))).build();
try {
groupsUpdate.updateGroup(groupUuid, groupDelta);
} catch (NoSuchGroupException e) {
throw new AccountException(String.format("Group %s not found", groupUuid), e);
}
}
use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class AddMembers method addMembers.
public void addMembers(AccountGroup.UUID groupUuid, Set<Account.Id> newMemberIds) throws IOException, NoSuchGroupException, ConfigInvalidException {
GroupDelta groupDelta = GroupDelta.builder().setMemberModification(memberIds -> Sets.union(memberIds, newMemberIds)).build();
groupsUpdateProvider.get().updateGroup(groupUuid, groupDelta);
}
Aggregations