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
|
If `SAME_GROUP`, only users who are also members of a group the
|
||||||
current user is a member of will be offered.
|
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.
|
If `OFF`, no account suggestions are given.
|
||||||
+
|
+
|
||||||
Default is `ALL`.
|
Default is `ALL`.
|
||||||
|
|
|
@ -17,5 +17,6 @@ package com.google.gerrit.httpd.rpc;
|
||||||
public enum SuggestAccountsEnum {
|
public enum SuggestAccountsEnum {
|
||||||
ALL,
|
ALL,
|
||||||
SAME_GROUP,
|
SAME_GROUP,
|
||||||
|
VISIBLE_GROUP,
|
||||||
OFF;
|
OFF;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,22 @@ class SuggestServiceImpl extends BaseServiceImplementation implements
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case OFF:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue