Switch to UUID of groups for all public methods of GroupsUpdate
Change-Id: I9a4bb23b69bf50b19b30f29ddbf65e621e42968a
This commit is contained in:
@@ -132,7 +132,7 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
"Username '" + username + "' must contain only letters, numbers, _, - or .");
|
||||
}
|
||||
|
||||
Set<AccountGroup.Id> groups = parseGroups(input.groups);
|
||||
Set<AccountGroup.UUID> groups = parseGroups(input.groups);
|
||||
|
||||
Account.Id id = new Account.Id(seq.nextAccountId());
|
||||
|
||||
@@ -185,8 +185,8 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
a.setPreferredEmail(input.email);
|
||||
});
|
||||
|
||||
for (AccountGroup.Id groupId : groups) {
|
||||
groupsUpdate.get().addGroupMember(db, groupId, id);
|
||||
for (AccountGroup.UUID groupUuid : groups) {
|
||||
groupsUpdate.get().addGroupMember(db, groupUuid, id);
|
||||
}
|
||||
|
||||
if (input.sshKey != null) {
|
||||
@@ -207,14 +207,15 @@ public class CreateAccount implements RestModifyView<TopLevelResource, AccountIn
|
||||
return Response.created(info);
|
||||
}
|
||||
|
||||
private Set<AccountGroup.Id> parseGroups(List<String> groups)
|
||||
private Set<AccountGroup.UUID> parseGroups(List<String> groups)
|
||||
throws UnprocessableEntityException {
|
||||
Set<AccountGroup.Id> groupIds = new HashSet<>();
|
||||
Set<AccountGroup.UUID> groupUuids = new HashSet<>();
|
||||
if (groups != null) {
|
||||
for (String g : groups) {
|
||||
groupIds.add(GroupDescriptions.toAccountGroup(groupsCollection.parseInternal(g)).getId());
|
||||
AccountGroup group = GroupDescriptions.toAccountGroup(groupsCollection.parseInternal(g));
|
||||
groupUuids.add(group.getGroupUUID());
|
||||
}
|
||||
}
|
||||
return groupIds;
|
||||
return groupUuids;
|
||||
}
|
||||
}
|
||||
|
@@ -98,7 +98,7 @@ public class PutAgreement implements RestModifyView<AccountResource, AgreementIn
|
||||
}
|
||||
|
||||
Account account = self.get().getAccount();
|
||||
addMembers.addMembers(group.getId(), ImmutableList.of(account.getId()));
|
||||
addMembers.addMembers(group.getGroupUUID(), ImmutableList.of(account.getId()));
|
||||
agreementSignup.fire(account, agreementName);
|
||||
|
||||
return Response.ok(agreementName);
|
||||
|
Reference in New Issue
Block a user