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

Make search_assignable_users_for_issues function GDPR compliant. #1117

Merged
merged 7 commits into from
Aug 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2891,21 +2891,24 @@ def search_assignable_users_for_projects(

def search_assignable_users_for_issues(
self,
username: str,
username: Optional[str] = None,
project: Optional[str] = None,
issueKey: Optional[str] = None,
expand: Optional[Any] = None,
startAt: int = 0,
maxResults: int = 50,
query: Optional[str] = None,
):
"""Get a list of user Resources that match the search string for assigning or creating issues.
"username" query parameter is deprecated in Jira Cloud; the expected parameter now is "query", which can just be
the full email again. But the "user" parameter is kept for backwards compatibility, i.e. Jira Server/Data Center.

This method is intended to find users that are eligible to create issues in a project or be assigned
to an existing issue. When searching for eligible creators, specify a project. When searching for eligible
assignees, specify an issue key.
adehad marked this conversation as resolved.
Show resolved Hide resolved

Args:
username (str): A string to match usernames against
username (Optional[str]): A string to match usernames against
project (Optional[str]): Filter returned users by permission in this project
(expected if a result will be used to create an issue)
issueKey (Optional[str]): Filter returned users by this issue
Expand All @@ -2914,17 +2917,27 @@ def search_assignable_users_for_issues(
startAt (int): Index of the first user to return (Default: 0)
maxResults (int): maximum number of users to return.
If maxResults evaluates as False, it will try to get all items in batches. (Default: 50)
query (Optional[str]): Search term. It can just be the email.

Returns:
ResultList
"""
params = {"username": username}
if username is not None:
params = {"username": username}
if query is not None:
params = {"query": query}
if project is not None:
params["project"] = project
if issueKey is not None:
params["issueKey"] = issueKey
if expand is not None:
params["expand"] = expand

if not username and not query:
raise ValueError(
"Either 'username' or 'query' arguments must be specified."
)

return self._fetch_pages(
User, None, "user/assignable/search", startAt, maxResults, params
)
Expand Down