Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search_users - allow search by query #924

Closed
robeden opened this issue Apr 9, 2020 · 6 comments · Fixed by #927
Closed

search_users - allow search by query #924

robeden opened this issue Apr 9, 2020 · 6 comments · Fixed by #927

Comments

@robeden
Copy link

robeden commented Apr 9, 2020

Is your feature request related to a problem? Please describe.
The search_users function currently only allows searching by username which is not supported when in strict GDPR mode. In that case, this error is returned:

The query parameter 'username' is not supported in GDPR strict mode.

Currently, I don't believe there is a way around this using public functions in the library.

Describe the solution you'd like
One option would be to add a parameter such as the following to the function:
useQuery = False. When done, then username key in the params would be replaced with query. I think that's all that needs to be done.

Describe alternatives you've considered
I can get around this problem by using the private _fetch_pages function:

found_users = _jira._fetch_pages(User, None, 'user/search', 0, 50, {"query": "me@example.invalid"})

... but obviously this is gross.

@svermeulen
Copy link

svermeulen commented Apr 18, 2020

The comment suggests that the given 'username' parameter can be an email or name too. Maybe that value should just be replaced by query? This is what I'm doing here

@robeden
Copy link
Author

robeden commented Apr 18, 2020

That would work. The only criticism would be that it’s a behavior change and could be surprising. The parameter with a default value would keep the API and behavior unchanged, but allow for using the new behavior if desired.

@vikoalucard
Copy link

Hi, I get the same problem, but can't even make the workaround to work.

I can get around this problem by using the private _fetch_pages function:

found_users = _jira._fetch_pages(User, None, 'user/search', 0, 50, {"query": "me@example.invalid"})

On my side:
allusers = jiratarget._fetch_pages(User, None, 'user/search', 0, 50, {"query": "username=noreplay@example.com"})
=> gets this error:
response text = {"errorMessages":["The username query parameter was not provided"],"errors":{}}

@adehad
Copy link
Contributor

adehad commented May 18, 2021

Following #927 we now do allow a query argument to be passed to search_users()

@adehad adehad closed this as completed May 18, 2021
@adehad adehad linked a pull request May 18, 2021 that will close this issue
@mattdough
Copy link

mattdough commented Nov 9, 2021

Should this be in the 3.0.1 version of the package?

When looking at the search_users definition it doesn't have the query added.

@adehad
Copy link
Contributor

adehad commented Nov 10, 2021

@mattdough this is included in the pre-release: pip install jira==3.1.0rc1

I can see it in the documentation here https://jira.readthedocs.io/api.html#jira.client.JIRA.search_users:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants