User membership needs to constrain search size
Description
Attachments
- 01 Sep 2021, 02:03 AM
- 01 Sep 2021, 02:03 AM
Activity

Ramana Reddy Battula April 8, 2022 at 2:46 PM
Tested on 21.x: https://qa21-mysql.nightly.sakaiproject.org/ ; build: 3d2e3dfa
Notes: Search button is disabled until characters are entered into the search bar. Similar to server 22, search bar becomes enabled when space is entered into it.

Andrea Schmidt January 4, 2022 at 10:35 PMEdited
Verified on 22x: https://qa22-mysql.nightly.sakaiproject.org/, build: 6711270b
The search button is disabled until something is entered into the search textbox. Unfortunately, it becomes enabled if a space is entered. Since this is already on 22 (and works the same way on 23), I’ll create a new Jira for the space issue.
Created SAK-46746

Miguel Pellicer September 1, 2021 at 2:03 AM
Thanks for the ideas @Stephen Marquard, I've submitted a PR with the suggested changes.
I found the UI kinda dated and old so I provided UI improvements too.
Old one:
New One:
Stephen Marquard June 16, 2021 at 12:15 PM
This is a functional fix that constrains the search size. Probably the UI should not enable the Search button until there's something entered in the search field.
diff -ur /usr/local/src/vula_src/branches/vula-20.x/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/UserListBean.java usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/UserListBean.java
--- /usr/local/src/vula_src/branches/vula-20.x/usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/UserListBean.java 2020-10-09 10:52:43.494958848 +0200
+++ usermembership/tool/src/java/org/sakaiproject/umem/tool/ui/UserListBean.java 2021-06-11 22:52:06.059870786 +0200
@@ -80,6 +80,8 @@
private static final String CFG_USER_TYPE_LIMIT_TO_SELF = "userType.limitToSelf";
private static final String CFG_USER_TYPE_LIMIT_TO_LIST = "userType.limitToList";
+ private static final int MAX_SEARCH_SIZE = 1000;
+
/** Resource bundle */
private static final ResourceLoader msgs = new ResourceLoader("org.sakaiproject.umem.tool.bundle.Messages");
@@ -327,9 +329,9 @@
//SAK-20857 if empty search, return all users, otherwise only those that match.
List<User> users;
if(StringUtils.isBlank(searchKeyword)) {
- users = M_uds.getUsers();
+ users = Collections.emptyList();
} else {
- users = M_uds.searchUsers(searchKeyword, 1, Integer.MAX_VALUE);
+ users = M_uds.searchUsers(searchKeyword, 1, MAX_SEARCH_SIZE);
}
for(User u : users) {

Shawn Foster June 14, 2021 at 1:32 PM
@Stephen Marquard, would the expected results after the fix be to say that the search field is empty and requires a username?
Should all search queries be limited to a certain number of results?
On sites with large numbers of users, a user membership tool search with either empty or very short search string (like "a") can return a very large result set which can cause memory issues and errors in the logs like
2021-06-11 11:34:54,268 WARN ajp-nio-0.0.0.0-8010-exec-107 org.sakaiproject.umem.tool.ui.UserListBean - Error occurred while sorting by: name
The memory issues can be severe enough to cause low memory conditions leading to denial of service.