-
Notifications
You must be signed in to change notification settings - Fork 7.4k
8000
admin/api
Behavior of /admin/realms/{realm}/users/count
and /admin/realms/{realm}/users
regarding parameters (and of course their results) is inconsistent, although both methods seem to use the same underlying search method(s).
26.1.3
Both API endpoints:
should accept the same (search) parameters and handle those in a similar way to ensure consistent responses and allow proper implementation of something like a pagination.
Also: Even if a search
parameter is set, the boolean parameters enabled
and emailVerified
should not be ignored.
Property | /users |
/users/count |
---|---|---|
search |
undocumented "special" behaviour: when search is set, other parameters (except enabled ) are ignored, but should also handle emailVerified |
should also handle emailVerified and enabled |
emailVerified |
✔ | ✔ |
enabled |
✔ | ✔ |
lastName |
✔ | ✔ |
firstName |
✔ | ✔ |
email |
✔ | ✔ |
username |
✔ | ✔ |
idpAlias |
✔ | parameter is missing |
idpUserId |
✔ | parameter is missing |
exact |
✔ | parameter is missing |
q |
✔ | ✔ |
first |
does not affect search query | does not affect search query |
max |
does not affect search query | does not affect search query |
briefRepresentation |
does not affect search query | does not affect search query |
Create two users:
user1
, Enabled: true
, EmailVerified: false
user2
, Enabled: false
, EmailVerified: true
enabled
Parameter is ignored in /users/count
endpoint:
http://localhost:8080/admin/realms/master/users?search=user&enabled=false
[
{"username": "user2", "enabled": false, "emailVerified": true, ...}
]
http://localhost:8080/admin/realms/master/users/count?search=user&enabled=false
2
emailVerified
Parameter is ignored in both endpoints:
http://localhost:8080/admin/realms/master/users?search=user&emailVerified=false
[
{"username": "user1", "enabled": true, "emailVerified": false, ...},
{"username": "user2", "enabled": false, "emailVerified": true, ...}
]
http://localhost:8080/admin/realms/master/users/count?search=user&emailVerified=false
2
If there is no concrete reason, why the count
endpoint should work differently, I might be able to provide a pull request with
/users/count
endpointenabled
and emailVerified
parameters together with search
parameter ind both endpoints