Skip to content

Commit d24900e

Browse files
YugoHinogonchik
authored andcommitted
add the account_id parameter for add_user_to_group (#1028)
1 parent 322d16e commit d24900e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

atlassian/jira.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,17 +759,27 @@ def get_all_users_from_group(self, group, include_inactive_users=False, start=0,
759759
params["maxResults"] = limit
760760
return self.get(url, params=params)
761761

762-
def add_user_to_group(self, username, group_name):
762+
def add_user_to_group(self, username=None, group_name=None, account_id=None):
763763
"""
764764
Add given user to a group
765765
766+
For Jira DC/Server platform
766767
:param username: str
767768
:param group_name: str
768769
:return: Current state of the group
770+
771+
For Jira Cloud platform
772+
:param account_id: str (name is no longer available for Jira Cloud platform)
773+
:param group_name: str
774+
:return: Current state of the group
769775
"""
770776
url = self.resource_url("group/user")
771777
params = {"groupname": group_name}
772-
data = {"name": username}
778+
url_domain = self.url
779+
if "atlassian.net" in url_domain:
780+
data = {"accountId": account_id}
781+
else:
782+
data = {"name": username}
773783
return self.post(url, params=params, data=data)
774784

775785
def remove_user_from_group(self, username=None, group_name=None, account_id=None):

docs/jira.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Manage groups
6969
jira.get_all_users_from_group(group, include_inactive_users=False, start=0, limit=50)
7070
7171
# Add given user to a group
72-
jira.add_user_to_group(username, group_name)
72+
jira.add_user_to_group(username=None, group_name=None, account_id=None)
7373
7474
# Remove given user from a group
7575
jira.remove_user_from_group(username=None, group_name=None, account_id=None)

0 commit comments

Comments
 (0)