Skip to content

Commit 127da36

Browse files
authored
crowd: require password as argument (#914)
Remove password autogeneration from user creation. Secrets library is not supported till Python 3.6. Signed-off-by: Martin Styk <[email protected]>
1 parent f929452 commit 127da36

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

atlassian/crowd.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# coding=utf-8
22
import logging
3-
import string
4-
import secrets
53

64
from .rest_client import AtlassianRestAPI
75

@@ -59,24 +57,20 @@ def user_activate(self, username):
5957

6058
return self._user_change_status(username, True)
6159

62-
def user_create(self, username, active, first_name, last_name, display_name, email, password=None):
60+
def user_create(self, username, active, first_name, last_name, display_name, email, password):
6361
"""
6462
Create new user method
65-
:param active: bool: OPTIONAL: password can be auto-generated if not included
63+
:param active: bool:
6664
:param username: string: username
6765
:param active: bool:
6866
:param first_name: string:
6967
:param last_name: string:
7068
:param display_name: string:
7169
:param email: string:
72-
:param password: string: OPTIONAL:
70+
:param password: string:
7371
:return:
7472
"""
7573

76-
if not password:
77-
characters = string.ascii_letters + string.punctuation + string.digits
78-
password = "".join(secrets.choice(characters) for x in range(30))
79-
8074
user_object = {
8175
"name": username,
8276
"password": {"value": password},

docs/crowd.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ Manage users
1212
# Add user
1313
crowd.user_create(username, active, first_name, last_name, display_name, email, password)
1414
15-
# Add user with auto-generated password
16-
crowd.user_create(username, active, first_name, last_name, display_name, email)
17-
1815
# Deactive user
1916
crowd.user_deactivate(username)
2017

0 commit comments

Comments
 (0)