Compare commits

...

9 Commits

Author SHA1 Message Date
Bruno Windels
c5e1de677d Merge branch 'develop' into bwindels/registerasregularuser 2018-09-27 19:18:38 +01:00
Bruno Windels
a776ccd8f5 add changelog 2018-09-21 12:51:55 +02:00
Bruno Windels
48957d2c8c didnt mean to commit this, obviously 2018-09-19 20:57:00 +02:00
Bruno Windels
bd37c4a444 fix logic, store_true/false doesn't set None by default but opposite bool 2018-09-19 20:55:26 +02:00
Bruno Windels
77f1de141d Merge branch 'develop' into bwindels/registerasregularuser 2018-09-19 18:18:40 +02:00
Bruno Windels
81b56f8078 make clear in help text when will be prompted 2018-09-19 18:18:08 +02:00
Bruno Windels
d4c389f0e4 remove not as the flags is set to false 2018-09-19 13:22:19 +02:00
Bruno Windels
4311f861a3 fix PR review 2018-09-19 12:30:32 +02:00
Bruno Windels
ceec6ce5f4 add --regular-user flag to registration script 2018-09-10 19:32:56 +02:00
2 changed files with 15 additions and 4 deletions

1
changelog.d/3836.bugfix Normal file
View File

@@ -0,0 +1 @@
support registering regular users non-interactively with register_new_matrix_user script

View File

@@ -133,7 +133,7 @@ def register_new_user(user, password, server_location, shared_secret, admin):
print "Passwords do not match"
sys.exit(1)
if not admin:
if admin is None:
admin = raw_input("Make admin [no]: ")
if admin in ("y", "yes", "true"):
admin = True
@@ -160,10 +160,16 @@ if __name__ == "__main__":
default=None,
help="New password for user. Will prompt if omitted.",
)
parser.add_argument(
admin_group = parser.add_mutually_exclusive_group()
admin_group.add_argument(
"-a", "--admin",
action="store_true",
help="Register new user as an admin. Will prompt if omitted.",
help="Register new user as an admin. Will prompt if --no-admin is not set either.",
)
admin_group.add_argument(
"--no-admin",
action="store_true",
help="Register new user as a regular user. Will prompt if --admin is not set either.",
)
group = parser.add_mutually_exclusive_group(required=True)
@@ -197,4 +203,8 @@ if __name__ == "__main__":
else:
secret = args.shared_secret
register_new_user(args.user, args.password, args.server_url, secret, args.admin)
admin = None
if args.admin or args.no_admin:
admin = args.admin
register_new_user(args.user, args.password, args.server_url, secret, admin)