-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
add --no-admin flag to registration script #3836
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woo, thanks, just a few nits
scripts/register_new_matrix_user
Outdated
help="Register new user as an admin. Will prompt if --regular-user is not set.", | ||
) | ||
parser.add_argument( | ||
"--regular-user", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traditionally this would probably be called --no-admin
, to make it clearer that its the opposite of --admin
.
scripts/register_new_matrix_user
Outdated
register_new_user(args.user, args.password, args.server_url, secret, args.admin) | ||
if args.admin and args.regular_user: | ||
print "Both --admin and --regular-user are set, choose either." | ||
sys.exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than doing this manually, we should probably use the inbuilt argparse conflict functionality: https://docs.python.org/2/howto/argparse.html#conflicting-options
scripts/register_new_matrix_user
Outdated
print "Both --admin and --regular-user are set, choose either." | ||
sys.exit(1) | ||
|
||
admin = True if args.admin else False if args.regular_user else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I honestly can't remember how multiple if statements like this work, can we write split it out into actual if statements please?
(You can also write this as args.admin or args.regular_user or None
, but that's a bit special too)
Fixes #2310 |
Instead of having 2 different flags (
It's backward-incompatible, but at least it does things cleanly. |
Opted for |
Not sure why the tests are failing though ... |
try merging latest develop; if nothing else, it will make circleci tell us why the tests are failing. |
As it is now:
So it seems like it's generally wrong now and also backward-incompatible (see case 3). |
Travis says:
|
In other words: "Please add a changelog fragment as per CONTRIBUTING.rst" |
Not sure why the tests are failing, but trying if merging in develop helps ... |
Tests on Travis seem to have passed, but they're still appearing as pending here for some reason ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
this happens occasionally if there is a problem when Travis comes to send the memo to github that the builds completed. I've restarted them. |
(thanks for bearing with us on this, @bwindels!) |
As the title says, I would like this option to be able to register non-admin users without interaction for the riot-web end-to-end tests, and thought it was a good way for a first synapse PR :)