Skip to content

Commit 2db3ff1

Browse files
authored
Just re-enable method (#437)
* [JIRA] Add method disable through REST api instead of crawling way
1 parent 13983e9 commit 2db3ff1

File tree

3 files changed

+17
-23
lines changed

3 files changed

+17
-23
lines changed

atlassian/bitbucket.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,17 @@ def delete_tag(self, project, repository, tag_name):
12391239
return self.delete(url)
12401240

12411241
def get_diff(self, project, repository, path, hash_oldest, hash_newest):
1242+
"""
1243+
Gets a diff of the changes available in the {@code from} commit but not in the {@code to} commit.
1244+
If either the {@code from} or {@code to} commit are not specified,
1245+
they will be replaced by the default branch of their containing repository.
1246+
:param project:
1247+
:param repository:
1248+
:param path:
1249+
:param hash_oldest: the source commit (can be a partial/full commit ID or qualified/unqualified ref name)
1250+
:param hash_newest: the target commit (can be a partial/full commit ID or qualified/unqualified ref name)
1251+
:return:
1252+
"""
12421253
if not self.cloud:
12431254
url = 'rest/api/1.0/projects/{project}/repos/{repository}/compare/diff/{path}'.format(project=project,
12441255
repository=repository,

atlassian/jira.py

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -231,30 +231,13 @@ def user_update_or_create_property_through_rest_point(self, username, key, value
231231

232232
def user_deactivate(self, username):
233233
"""
234-
Disable user
234+
Disable user. Works from 8.3.0 Release
235+
https://docs.atlassian.com/software/jira/docs/api/REST/8.3.0/#api/2/user-updateUser
235236
:param username:
236237
:return:
237238
"""
238-
url = 'secure/admin/user/EditUser.jspa'
239-
headers = self.form_token_headers
240-
user = self.user(username)
241-
data = {
242-
'inline': 'true',
243-
'decorator': 'dialog',
244-
'username': user['name'],
245-
'fullName': user['displayName'],
246-
'email': user['emailAddress'],
247-
'editName': user['name']
248-
}
249-
answer = self.get('secure/admin/WebSudoAuthenticate.jspa', self.form_token_headers)
250-
atl_token = None
251-
if answer:
252-
atl_token = \
253-
answer.split('<meta id="atlassian-token" name="atlassian-token" content="')[1].split('\n')[0].split(
254-
'"')[0]
255-
if atl_token:
256-
data['atl_token'] = atl_token
257-
return self.post(data=data, path=url, headers=headers)
239+
data = {"active": "false", "name": username}
240+
return self.user_update(username=username, data=data)
258241

259242
def user_disable(self, username):
260243
"""Override the disable method"""
@@ -2080,7 +2063,7 @@ def tempo_4_timesheets_find_worklogs(self, **params):
20802063
:param maxResults: integer
20812064
:param offset: integer
20822065
"""
2083-
2066+
20842067
url = "rest/tempo-timesheets/4/worklogs/search"
20852068
return self.post(url, data=params)
20862069

docs/jira.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Manage users
4242
# Remove user
4343
jira.user_remove(username)
4444
45-
# Deactivate user
45+
# Deactivate user. Works from 8.3.0 release
4646
jira.user_deactivate(username)
4747
4848
# Get web sudo cookies using normal http request

0 commit comments

Comments
 (0)