pycontribs / jira

Python Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
https://jira.readthedocs.io
BSD 2-Clause "Simplified" License
1.94k stars 859 forks source link

Search User does not return inactive users #1694

Open nathan-gilbert opened 1 year ago

nathan-gilbert commented 1 year ago

Bug summary

The following only returns active users: search_users(maxResults=False, includeInactive=True, query="%")

This generates a request like: GET /rest/api/2/user/search?query=%25&includeActive=True&includeInactive=True&maxResults=100

Which does not return inactive users, only active.

In order to get all users (inactive + active) the following request needs to be generated (as verified with Postman): /rest/api/2/users/search?includeInactive=true&query=%25&maxResults=100

A workaround is to do: _fetch_pages(User, None, "users/search", 0, 100, {"includeInactive": "true", "query": "%"}) but that isn't the intended usage of this library.

This was tested with Python 3.11.4.

Is there an existing issue for this?

Jira Instance type

Jira Cloud (Hosted by Atlassian)

Jira instance version

No response

jira-python version

3.5.2

Python Interpreter version

3.11

Which operating systems have you used?

Reproduction steps

# 1. Given a Jira client instance
jira: JIRA
# 2. When I call the function with argument x
jira.the_function(x)
# 3.
...

Stack trace

None

Expected behaviour

All users, inactive and active, are returned.

Additional Context

No response

adehad commented 1 year ago

The params need to run through json.dumps() in order to be in the correct format. We should probably do a quick audit of all instances where we pass in params= and ensure that all booleans are handles correctly.

Proposed work around for now:

search_users(maxResults=False, includeInactive="true", query="%")