Skip to content

Commit

Permalink
Make search_assignable_users_for_issues function GDPR compliant. (#1117)
Browse files Browse the repository at this point in the history
* Added query parameter to `search_assignable_users_for_issues()` function for GDPR compatibality.

* Update docstring
  • Loading branch information
nelli-acc authored Aug 10, 2021
1 parent 20680c5 commit 502e554
Showing 1 changed file with 16 additions and 3 deletions.
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.
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

0 comments on commit 502e554

Please sign in to comment.