p2-inc / keycloak-orgs

Single realm, multi-tenancy for SaaS apps
https://phasetwo.io
Other
417 stars 72 forks source link

OrganizationsApi returns maximum 100 organizations even if the max argument passed is more than 100 #271

Closed ebenoit26 closed 1 month ago

ebenoit26 commented 1 month ago

Hi,

We are currently using the keycloak-orgs version 0.78 with Keycloak 25.0.5.

phaseTwo .getOrganizationsApi() .getOrganizations( keycloakConfig.getRealm(), null, null, 200, null));

This API call is made to get up to 200 organizations with the max argument set to 200. However with this version we always get a maximum number of 100 organizations even if there are more...

Before we used the version 0.27 of keycloak-orgs and it was returning more than 100 organizations with the same API call.

Also, with the version 0.78, the Organization Memberships API is not blocked to 100 items:

phaseTwo .getOrganizationMembershipsApi() .getOrganizationMemberships( keycloakConfig.getRealm(), organizationRepresentation.getId(), null, null, 200);

I was wondering why one API is blocked to 100 items and not the other one?

Thanks in advance.

xgp commented 1 month ago

Performance. The maxResults maximum was changed a while ago. Just use firstResult to paginate.

https://github.com/p2-inc/keycloak-orgs/blob/main/src/main/java/io/phasetwo/service/resource/OrganizationsResource.java#L103-L106