use of com.google.gerrit.server.group.db.GroupsUpdate 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);
}
}
Aggregations