mirror of
https://github.com/keycloak/keycloak.git
synced 2026-05-28 04:13:22 -04:00
Merge 502e6a6a9f into 94dcc24a8d
This commit is contained in:
commit
e17446efa6
2 changed files with 15 additions and 0 deletions
|
|
@ -324,6 +324,7 @@ public class UsersResource {
|
|||
attributes.put(UserModel.EMAIL_VERIFIED, emailVerified.toString());
|
||||
}
|
||||
addCreatedTimestampConditions(attributes, createdAfter, createdBefore);
|
||||
attributes.putAll(searchAttributes);
|
||||
|
||||
return searchForUser(attributes, realm, userPermissionEvaluator, briefRepresentation, firstResult,
|
||||
maxResults, false);
|
||||
|
|
@ -456,6 +457,7 @@ public class UsersResource {
|
|||
parameters.put(UserModel.EMAIL_VERIFIED, emailVerified.toString());
|
||||
}
|
||||
addCreatedTimestampConditions(parameters, createdAfter, createdBefore);
|
||||
parameters.putAll(searchAttributes);
|
||||
// search /users equivalent to this doesn't include service-accounts so counting shouldn't as well
|
||||
parameters.put(UserModel.INCLUDE_SERVICE_ACCOUNT, "false");
|
||||
if (userPermissionEvaluator.canView()) {
|
||||
|
|
|
|||
|
|
@ -136,6 +136,19 @@ public class UserSearchTest extends AbstractUserTest {
|
|||
assertEquals(0, users.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DatabaseTest
|
||||
public void searchUserWithQueryParameter() {
|
||||
createUsers();
|
||||
|
||||
String query = mapToSearchQuery(Map.of("test", "test1"));
|
||||
assertThat(managedRealm.admin().users().searchByAttributes(query), hasSize(1));
|
||||
List<UserRepresentation> users = managedRealm.admin().users().search("username", null, null, null, null, null, null, query);
|
||||
assertThat(users, hasSize(1));
|
||||
assertThat(users.get(0).getUsername(), is("username1"));
|
||||
assertThat(managedRealm.admin().users().count("username", null, null, null, null, null, null, query), is(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DatabaseTest
|
||||
public void searchByMultipleAttributes() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue