-
Notifications
You must be signed in to change notification settings - Fork 151
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
Username can be updated in configuration #1204
base: main
Are you sure you want to change the base?
Conversation
|
@@ -278,7 +278,7 @@ jobs: | |||
|
|||
- uses: actions/[email protected] | |||
with: | |||
python-version: 3.7 | |||
python-version: 3.9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi thendo please bump the python-version to 3.9 to Sync with the main.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @AssahBismarkabah, okay will do
@@ -59,11 +59,28 @@ public Optional<UserRepresentation> search(String realmName, String username) { | |||
return user; | |||
} | |||
|
|||
public Optional<UserRepresentation> searchByEmail(String realmName, String email) { | |||
UsersResource usersResource = realmRepository.getResource(realmName).users(); | |||
List<UserRepresentation> foundUsers = usersResource.search(email, 0, 50); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there are more than 50 users in the realm, and the user with the matching email is not among the first 50 results returned by the search, the search will fail to find the user, even if they exist. To ensure the user is located, you could search among all users.
public Optional<UserRepresentation> searchByEmail(String realmName, String email) {
UsersResource usersResource = realmRepository.getResource(realmName).users();
List<UserRepresentation> foundUsers = usersResource.searchByEmail(email, true);
return foundUsers.isEmpty() ? Optional.empty() : Optional.of(foundUsers.get(0));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay, I thought the search function will look through all the users then returns 50 or less elements/users that have a partial match to the email that you're looking for.
What this PR does / why we need it:
Which issue this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close that issue when PR gets merged): fixes #Special notes for your reviewer:
PR Readiness Checklist:
Complete these before marking the PR as
ready to review
:CHANGELOG.md
release notes have been updated to reflect any significant (and particularly user-facing) changes introduced by this PR