Make sure pagination is used even when first is null for getGroups endpoint
Closes #25731 Signed-off-by: Michal Hajas <mhajas@redhat.com>
This commit is contained in:
parent
b4d289c562
commit
e55ba5dcdc
2 changed files with 15 additions and 5 deletions
|
@ -100,10 +100,8 @@ public class GroupsResource {
|
|||
stream = ModelToRepresentation.searchGroupModelsByAttributes(session, realm, attributes, firstResult, maxResults);
|
||||
} else if (Objects.nonNull(search)) {
|
||||
stream = session.groups().searchForGroupByNameStream(realm, search.trim(), exact, firstResult, maxResults);
|
||||
} else if(Objects.nonNull(firstResult) && Objects.nonNull(maxResults)) {
|
||||
stream = session.groups().getTopLevelGroupsStream(realm, firstResult, maxResults);
|
||||
} else {
|
||||
stream = session.groups().getTopLevelGroupsStream(realm);
|
||||
stream = session.groups().getTopLevelGroupsStream(realm, firstResult, maxResults);
|
||||
}
|
||||
|
||||
if (populateHierarchy) {
|
||||
|
|
|
@ -1149,9 +1149,21 @@ public class GroupTest extends AbstractGroupTest {
|
|||
List<GroupRepresentation> allGroups = realm.groups().groups();
|
||||
assertEquals(20, allGroups.size());
|
||||
|
||||
List<GroupRepresentation> slice = realm.groups().groups(5, 7);
|
||||
List<GroupRepresentation> slice = realm.groups().groups(0, 7);
|
||||
assertEquals(7, slice.size());
|
||||
|
||||
slice = realm.groups().groups(null, 7);
|
||||
assertEquals(7, slice.size());
|
||||
|
||||
slice = realm.groups().groups(10, null);
|
||||
assertEquals(10, slice.size());
|
||||
|
||||
slice = realm.groups().groups(5, 7);
|
||||
assertEquals(7, slice.size());
|
||||
|
||||
slice = realm.groups().groups(15, 7);
|
||||
assertEquals(5, slice.size());
|
||||
|
||||
List<GroupRepresentation> search = realm.groups().groups("group1",0,20);
|
||||
assertEquals(11, search.size());
|
||||
for(GroupRepresentation group : search) {
|
||||
|
|
Loading…
Reference in a new issue