8000 Consistent behaviour for User API getUsers and count · Issue #38556 · keycloak/keycloak · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Consistent behaviour for User API getUsers and count #38556
Closed
@resah

Description

@resah

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

admin/api

Describe the bug

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).

Version

26.1.3

Regression

  • The issue is a regression

Expected behavior

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.

Actual behavior

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

How to Reproduce?

Create two users:

  • Username: user1, Enabled: true, EmailVerified: false
  • Username: user2, Enabled: false, EmailVerified: true

enabled

Parameter is ignored in /users/count endpoint:

/users-Endpoint

http://localhost:8080/admin/realms/master/users?search=user&enabled=false

[
  {"username": "user2", "enabled": false, "emailVerified": true, ...}
]

/users/count-Endpoint

http://localhost:8080/admin/realms/master/users/count?search=user&enabled=false

2

emailVerified

Parameter is ignored in both endpoints:

/users-Endpoint

http://localhost:8080/admin/realms/master/users?search=user&emailVerified=false

[
  {"username": "user1", "enabled": true, "emailVerified": false, ...},
  {"username": "user2", "enabled": false, "emailVerified": true, ...}
]

/users/count-Endpoint

http://localhost:8080/admin/realms/master/users/count?search=user&emailVerified=false

2

Anything else?

If there is no concrete reason, why the count endpoint should work differently, I might be able to provide a pull request with

  • adding missing parameters in /users/count endpoint
  • allow enabled and emailVerified parameters together with search parameter ind both endpoints

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0