Avoid unnecessary group visibility checks
The list-groups REST API call checked group visibility even for those groups which are filtered out. In a system with 10-20K of groups this can cause 30-60 seconds delay when checking if current user can see a group. Avoid unnecessary group visibility checks by moving it towards the end of the loop. Therefore, group visibility is only checked for those groups which are not filtered out. Change-Id: Id5984049d0103fbbf656b704f672f01283844b64
This commit is contained in:
parent
1d55a32535
commit
df0145d52f
@ -322,12 +322,6 @@ public class ListGroups implements RestReadView<TopLevelResource> {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!isAdmin) {
|
||||
final GroupControl c = groupControlFactory.controlFor(group);
|
||||
if (!c.isVisible()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (visibleToAll && !group.isVisibleToAll()) {
|
||||
continue;
|
||||
}
|
||||
@ -335,6 +329,12 @@ public class ListGroups implements RestReadView<TopLevelResource> {
|
||||
&& !groupsToInspect.contains(group.getGroupUUID())) {
|
||||
continue;
|
||||
}
|
||||
if (!isAdmin) {
|
||||
final GroupControl c = groupControlFactory.controlFor(group);
|
||||
if (!c.isVisible()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
filteredGroups.add(group);
|
||||
}
|
||||
Collections.sort(filteredGroups, new GroupComparator());
|
||||
|
Loading…
x
Reference in New Issue
Block a user