Skip to content

Commit 70019f5

Browse files
authored
Adding change password to confluence.py (#1201)
* Adding change password to confluence.py Adding a function for the following methods: - changeUserPassword - changeMyPassword https://developer.atlassian.com/server/confluence/remote-confluence-methods/ * docs
1 parent 77a3bff commit 70019f5

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

atlassian/confluence.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,6 +2871,31 @@ def add_user(self, email, fullname, username, password):
28712871
}
28722872
self.post(url, data=data)
28732873

2874+
def change_user_password(self, username, password):
2875+
"""
2876+
That method related to changing user password via json rpc for Confluence Server
2877+
"""
2878+
params = {"name": username}
2879+
url = "rpc/json-rpc/confluenceservice-v2"
2880+
data = {
2881+
"jsonrpc": "2.0",
2882+
"method": "changeUserPassword",
2883+
"params": [params, password],
2884+
}
2885+
self.post(url, data=data)
2886+
2887+
def change_my_password(self, oldpass, newpass):
2888+
"""
2889+
That method related to changing calling user's own password via json rpc for Confluence Server
2890+
"""
2891+
url = "rpc/json-rpc/confluenceservice-v2"
2892+
data = {
2893+
"jsonrpc": "2.0",
2894+
"method": "changeMyPassword",
2895+
"params": [oldpass, newpass],
2896+
}
2897+
self.post(url, data=data)
2898+
28742899
def add_user_to_group(self, username, group_name):
28752900
"""
28762901
Add given user to a group

docs/confluence.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ Users and Groups
231231
# Get information about a user through user key
232232
confluence.get_user_details_by_userkey(userkey, expand=None)
233233
234+
# Change a user's password
235+
confluence.change_user_password(username, password)
236+
237+
# Change calling user's password
238+
confluence.change_my_password(oldpass, newpass)
239+
234240
CQL
235241
---
236242

0 commit comments

Comments
 (0)