Add config setting to only suggest users which are in a visible group
Add a new setting for the suggest section in the Gerrit configuration that limits the suggested users to those which are in at least one group that is visible to the current user. Change-Id: I89654bfdf63e2b780c5e0c93ee54b14afc1640a0 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
parent
b052ca8dcf
commit
4248881072
|
@ -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