Skip to content

Commit f62d95e

Browse files
YugoHinogonchik
authored andcommitted
Add function get_user_groups (#1041)
1 parent abe8bb2 commit f62d95e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

atlassian/jira.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,17 @@ def add_user_to_application(self, username, application_key):
18411841
Reference: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/project
18421842
"""
18431843

1844+
def get_user_groups(self, account_id=None):
1845+
"""
1846+
Get groups of a user
1847+
This API is only available for Jira Cloud platform
1848+
:param account_id: str
1849+
:return: list of group info
1850+
"""
1851+
params = {"accountId": account_id}
1852+
url = self.resource_url("user/groups")
1853+
return self.get(url, params=params)
1854+
18441855
def get_all_projects(self, included_archived=None, expand=None):
18451856
return self.projects(included_archived, expand)
18461857

docs/jira.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ Manage users
5151
# Fuzzy search using emailAddress or displayName
5252
jira.user_find_by_user_string(query, start=0, limit=50, include_inactive_users=False)
5353
54+
# Get groups of a user. This API is only available for Jira Cloud platform.
55+
jira.get_user_groups(account_id)
56+
5457
Manage groups
5558
-------------
5659

0 commit comments

Comments
 (0)