Merge "Add config setting to only suggest users which are in a visible group" into stable
This commit is contained in:
commit
e647a81b1d
|
@ -1779,6 +1779,9 @@ or a user to a group.
|
|||
If `SAME_GROUP`, only users who are also members of a group the
|
||||
current user is a member of will be offered.
|
||||
+
|
||||
If `VISIBLE_GROUP`, only users who are members of at least one group
|
||||
that is visible to the current user will be offered.
|
||||
+
|
||||
If `OFF`, no account suggestions are given.
|
||||
+
|
||||
Default is `ALL`.
|
||||
|
|
|
@ -17,5 +17,6 @@ package com.google.gerrit.httpd.rpc;
|
|||
public enum SuggestAccountsEnum {
|
||||
ALL,
|
||||
SAME_GROUP,
|
||||
VISIBLE_GROUP,
|
||||
OFF;
|
||||
}
|
||||
|
|
|
@ -165,6 +165,22 @@ class SuggestServiceImpl extends BaseServiceImplementation implements
|
|||
}
|
||||
break;
|
||||
}
|
||||
case VISIBLE_GROUP: {
|
||||
Set<AccountGroup.Id> usersGroups = groupsOf(account);
|
||||
usersGroups.removeAll(authConfig.getRegisteredGroups());
|
||||
usersGroups.remove(authConfig.getBatchUsersGroup());
|
||||
for (AccountGroup.Id usersGroup : usersGroups) {
|
||||
try {
|
||||
if (groupControlFactory.controlFor(usersGroup).isVisible()) {
|
||||
map.put(account.getId(), info);
|
||||
break;
|
||||
}
|
||||
} catch (NoSuchGroupException e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OFF:
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue