Skip to content

Commit 12793dd

Browse files
author
Gonchik Tsymzhitov
committed
Confluence:add user
1 parent 6b5a592 commit 12793dd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

atlassian/confluence.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ def get_parent_content_id(self, page_id):
111111
parent_content_id = None
112112
try:
113113
parent_content_id = (
114-
(self.get_page_by_id(page_id=page_id, expand='ancestors').get('ancestors') or {})[-1].get(
115-
'id') or None)
114+
(self.get_page_by_id(page_id=page_id, expand='ancestors').get('ancestors') or {})[-1].get(
115+
'id') or None)
116116
except Exception as e:
117117
log.error(e)
118118
return parent_content_id
@@ -1939,6 +1939,15 @@ def avatar_set_default_for_user(self, user_key):
19391939
url = 'rest/user-profile/1.0/{}/avatar/default'.format(user_key)
19401940
return self.get(url)
19411941

1942+
def add_user(self, email, fullname, username, password):
1943+
"""
1944+
That method related to creating user via json rpc for Confluence Server
1945+
"""
1946+
params = {"email": email, "fullname": fullname, "name": username}
1947+
url = 'rpc/json-rpc/confluenceservice-v2'
1948+
data = {"jsonrpc": "2.0", "method": "addUser", "params": [params, password]}
1949+
self.post(url, data=data)
1950+
19421951
def add_user_to_group(self, username, group_name):
19431952
"""
19441953
Add given user to a group

0 commit comments

Comments
 (0)