use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class DeleteSubgroups method removeSubgroups.
private void removeSubgroups(AccountGroup.UUID parentGroupUuid, Set<AccountGroup.UUID> removedSubgroupUuids) throws NoSuchGroupException, IOException, ConfigInvalidException {
GroupDelta groupDelta = GroupDelta.builder().setSubgroupModification(subgroupUuids -> Sets.difference(subgroupUuids, removedSubgroupUuids)).build();
groupsUpdateProvider.get().updateGroup(parentGroupUuid, groupDelta);
}
use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class AddSubgroups method addSubgroups.
private void addSubgroups(AccountGroup.UUID parentGroupUuid, Set<AccountGroup.UUID> newSubgroupUuids) throws NoSuchGroupException, IOException, ConfigInvalidException {
GroupDelta groupDelta = GroupDelta.builder().setSubgroupModification(subgroupUuids -> Sets.union(subgroupUuids, newSubgroupUuids)).build();
groupsUpdateProvider.get().updateGroup(parentGroupUuid, groupDelta);
}
use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class SchemaCreatorImpl method createAdminsGroup.
private void createAdminsGroup(Sequences seqs, Repository allUsersRepo, GroupReference groupReference) throws IOException, ConfigInvalidException {
InternalGroupCreation groupCreation = getGroupCreation(seqs, groupReference);
GroupDelta groupDelta = GroupDelta.builder().setDescription("Gerrit Site Administrators").build();
createGroup(allUsersRepo, groupCreation, groupDelta);
}
use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class GroupsUpdateIT method createGroup.
private void createGroup(String groupName, String groupUuid) throws Exception {
InternalGroupCreation groupCreation = getGroupCreation(groupName, groupUuid);
GroupDelta groupDelta = GroupDelta.builder().build();
createGroup(groupCreation, groupDelta);
}
use of com.google.gerrit.server.group.db.GroupDelta in project gerrit by GerritCodeReview.
the class PutOwner method apply.
@Override
public Response<GroupInfo> apply(GroupResource resource, OwnerInput input) throws ResourceNotFoundException, NotInternalGroupException, AuthException, BadRequestException, UnprocessableEntityException, IOException, ConfigInvalidException, PermissionBackendException {
GroupDescription.Internal internalGroup = resource.asInternalGroup().orElseThrow(NotInternalGroupException::new);
if (!resource.getControl().isOwner()) {
throw new AuthException("Not group owner");
}
if (input == null || Strings.isNullOrEmpty(input.owner)) {
throw new BadRequestException("owner is required");
}
GroupDescription.Basic owner = groupResolver.parse(input.owner);
if (!internalGroup.getOwnerGroupUUID().equals(owner.getGroupUUID())) {
AccountGroup.UUID groupUuid = internalGroup.getGroupUUID();
GroupDelta groupDelta = GroupDelta.builder().setOwnerGroupUUID(owner.getGroupUUID()).build();
try {
groupsUpdateProvider.get().updateGroup(groupUuid, groupDelta);
} catch (NoSuchGroupException e) {
throw new ResourceNotFoundException(String.format("Group %s not found", groupUuid), e);
}
}
return Response.ok(json.format(owner));
}
Aggregations