Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backend support for Manage Users pagination #8370

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mpbrown
Copy link
Collaborator

@mpbrown mpbrown commented Dec 24, 2024

BACKEND PULL REQUEST

Related Issue

Changes Proposed

  • Adds backend support for pagination on manage users page

Additional Information

Testing

  • Deployed on dev4
  • This should still behave exactly like main

pageNumber = ApiUserService.DEFAULT_OKTA_USER_PAGE_OFFSET;
}
if (!searchQuery.isBlank()) {
return _userService.searchUsersAndStatusInCurrentOrgPaged(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search is being handled by a different service method here only as an intermediate step between now and the rest of the Okta migration. Currently, we have to fetch the entire organization's user list from Okta in order to do this search. Once we switch to getting users from our database, we can have the other method below use the search filter easily.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to confirm, we aren't using this search functionality on the frontend just yet, right? That's being introduced with your frontend PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, so this new endpoint is not currently being used anywhere in the app until the frontend PR


List<Group> facilityAccessGroup =
groupApi.listGroups(facilityAccessGroupName, null, null, 1, "stats", null, null, null);
private Integer getUsersCountInOktaGroup(String groupName) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pagination needed the total number of users in an organization, so I split this logic out to be shared for facilities and organizations.


final Map<String, UserStatus> emailsToStatus =
_oktaRepo.getPagedUsersWithStatusForOrganization(org, pageNumber, pageSize);
List<ApiUser> users = _apiUserRepo.findAllByLoginEmailInOrderByName(emailsToStatus.keySet());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part of the method will be updated in this future ticket to fetch users from the DB instead of having to get them from Okta first.


public Page<ApiUserWithStatus> searchUsersAndStatusInCurrentOrgPaged(
int pageNumber, int pageSize, String searchQuery) {
List<ApiUserWithStatus> allUsers = getUsersAndStatusInCurrentOrg();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mpbrown mpbrown force-pushed the mike/8103-manage-users-pagination-backend branch from 3a6b61e to d3166f1 Compare January 2, 2025 16:57
Copy link
Collaborator

@emyl3 emyl3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple questions! Thanks for all your work on this so far, MIke!

List<ApiUserWithStatus> filteredUsersList =
allUsers.stream()
.filter(
u -> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we do u.getNameInfo().toString().toLowerCase() to get the full name here instead or are we purposefully trying to avoid including a user's suffix in their name? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are purposefully excluding suffix based on the existing frontend search in UsersSideNav that filters based on first, middle, and last names

pageNumber = ApiUserService.DEFAULT_OKTA_USER_PAGE_OFFSET;
}
if (!searchQuery.isBlank()) {
return _userService.searchUsersAndStatusInCurrentOrgPaged(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to confirm, we aren't using this search functionality on the frontend just yet, right? That's being introduced with your frontend PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants