Skip to content
Snippets Groups Projects
Commit fb1da439 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: change arguments of create_user

create a mutually exclusive group instead of another optional argument
parent 1592fce3
No related branches found
No related tags found
1 merge request!33MAINT: change arguments of create_user
Pipeline #12392 passed with warnings
......@@ -123,6 +123,7 @@ def do_create_user(args):
try:
admin._insert_user(name=args.user_name,
email=args.user_email, password=password)
if args.activate_user:
do_activate_user(args)
except HTTPClientError as e:
......@@ -306,12 +307,21 @@ USAGE
# users (CRUD)
subparser = subparsers.add_parser(
"create_user",
help="Create a new user in caosdb's internal user database.")
help="Create a new user in caosdb's internal user database. You need "
" to activate the user before use.")
subparser.set_defaults(call=do_create_user)
subparser.add_argument("-a", "--ask-password",
help="Prompt for a password.", action="store_true")
mg = subparser.add_mutually_exclusive_group()
mg.add_argument("-a", "--ask-password",
help="Prompt for a password.", action="store_true")
mg.add_argument(
"--password",
dest="user_password",
default=None,
help="Alternative way to provide the new user's password. Please "
"consider to use the more secure, interactive way (-a option).")
subparser.add_argument("-c", "--activate-user",
help="Activate the user after creation.", action="store_true")
help="Activate the user after creation.",
action="store_true")
subparser.add_argument(
metavar='USERNAME',
dest="user_name",
......@@ -321,12 +331,6 @@ USAGE
nargs='?',
dest="user_email",
help="The email address of the new user.")
subparser.add_argument(
metavar='PASSWORD',
nargs="?",
dest="user_password",
default=None,
help="The new user's password. This is overwritten by the -a option.")
subparser = subparsers.add_parser(
"activate_user", help="(Re-)activate an inactive (but existing) user.")
......@@ -344,7 +348,8 @@ USAGE
subparser = subparsers.add_parser(
"set_user_password",
help="Set a new password for a user. You will be prompted for the password if PASSWORD is not given.")
help="Set a new password for a user. "
"By default, you will be prompted for the password.")
subparser.set_defaults(call=do_set_user_password)
subparser.add_argument(
metavar='USERNAME',
......@@ -355,7 +360,8 @@ USAGE
nargs="?",
dest="user_password",
default=None,
help="The user's new password.")
help="Alternative way to provide the user's new password. "
"The more secure (and default way) is to provide it interactively.")
subparser = subparsers.add_parser(
"set_user_entity",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment