Do not try to list members of external groups
Members of external groups cannot be listed, hence immediately fail with ResourceNotFoundException. This is the same what is done for other REST endpoints that are only supported for Gerrit internal groups (e.g. listing included groups). Change-Id: Ic53643a687bbfba3c19fbf5a0ecac2df21ec74bc Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
parent
1da7676b4a
commit
2dc5edc071
@ -484,7 +484,7 @@ Group Member Endpoints
|
||||
[[group-members]]
|
||||
GET /groups/\{group-id\}/members/ (List Group Members)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Lists the direct members of a group.
|
||||
Lists the direct members of a Gerrit internal group.
|
||||
|
||||
As result a list of link:#member-info[MemberInfo] entries is returned.
|
||||
The entries in the list are sorted by full name, preferred email and
|
||||
|
@ -64,6 +64,9 @@ public class ListMembers implements RestReadView<GroupResource> {
|
||||
public List<MemberInfo> apply(final GroupResource resource)
|
||||
throws AuthException, BadRequestException, ResourceConflictException,
|
||||
Exception {
|
||||
if (resource.toAccountGroup() == null) {
|
||||
throw new ResourceNotFoundException(resource.getGroupUUID().get());
|
||||
}
|
||||
final Map<Account.Id, MemberInfo> members =
|
||||
getMembers(resource.getGroupUUID(), new HashSet<AccountGroup.UUID>());
|
||||
final List<MemberInfo> memberInfos = Lists.newArrayList(members.values());
|
||||
|
Loading…
Reference in New Issue
Block a user