Allow including external groups in Gerrit internal groups

Clients must use the external group's UUID when adding an included
group. Using the UUID enables the server to resolve the group.

Change-Id: I0706eda738be195c68211856cb93bf824ee2d5a8
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
This commit is contained in:
Dariusz Luksza 2013-06-07 11:07:38 +02:00 committed by Shawn Pearce
parent f85c67af50
commit ccfa64994e
2 changed files with 12 additions and 4 deletions

View File

@ -934,7 +934,8 @@ Include Group
[verse]
'PUT /groups/link:#group-id[\{group-id\}]/groups/link:#group-id[\{group-id\}]'
Includes a group into a Gerrit internal group.
Includes an internal or external group into a Gerrit internal group.
External groups must be specified using the UUID.
.Request
----

View File

@ -58,6 +58,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
private Button delInclude;
private FlowPanel noMembersInfo;
private AccountGroupSuggestOracle accountGroupSuggestOracle;
public AccountGroupMembersScreen(final GroupInfo toShow, final String token) {
super(toShow, token);
@ -109,9 +110,10 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
}
private void initIncludeList() {
accountGroupSuggestOracle = new AccountGroupSuggestOracle();
addIncludeBox =
new AddMemberBox(Util.C.buttonAddIncludedGroup(),
Util.C.defaultAccountGroupName(), new AccountGroupSuggestOracle());
Util.C.defaultAccountGroupName(), accountGroupSuggestOracle);
addIncludeBox.addClickHandler(new ClickHandler() {
@Override
@ -187,13 +189,18 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
}
void doAddNewInclude() {
final String groupName = addIncludeBox.getText();
String groupName = addIncludeBox.getText();
if (groupName.length() == 0) {
return;
}
AccountGroup.UUID uuid = accountGroupSuggestOracle.getUUID(groupName);
if (uuid == null) {
return;
}
addIncludeBox.setEnabled(false);
GroupApi.addIncludedGroup(getGroupUUID(), groupName,
GroupApi.addIncludedGroup(getGroupUUID(), uuid.get(),
new GerritCallback<GroupInfo>() {
public void onSuccess(final GroupInfo result) {
addIncludeBox.setEnabled(true);