From ccfa64994e162c58d9215f6f4c127b7ded08ea29 Mon Sep 17 00:00:00 2001 From: Dariusz Luksza Date: Fri, 7 Jun 2013 11:07:38 +0200 Subject: [PATCH] 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 --- Documentation/rest-api-groups.txt | 3 ++- .../client/admin/AccountGroupMembersScreen.java | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Documentation/rest-api-groups.txt b/Documentation/rest-api-groups.txt index 4785350ec6..d8f021bdbc 100644 --- a/Documentation/rest-api-groups.txt +++ b/Documentation/rest-api-groups.txt @@ -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 ---- diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java index 51ff978fa4..4e8f710278 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java @@ -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() { public void onSuccess(final GroupInfo result) { addIncludeBox.setEnabled(true);