-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for registration token management #42
Conversation
Hi @govynnus, thank you so much for the submission. Probably the most complete PR ever submitted to this repo ;-)) Thanks for adding docstrings and even extending the Sphinx .rst files! Great! Overall this looks coded very thorougly but before I can give you feedback I should read a little about what exactly this new Synapse feature does. The "latest docs" link does not work yet (https://matrix-org.github.io/synapse/latest/usage/administration/admin_api/registration_tokens.html). You have a dev-version link of the docs for me, that's up and readably already? Thanks! |
Hi @JOJ0 :-) I did mean to add a convenient date format, but forgot. Handy that you already have some examples for me to have a look at :) |
no leave it as the final/released docs link. so we don't have to change it later. I think that's fine. Just wanted to find it to read a little about it myself :-) perfect regarding date format convenience. we are not in a hurry with getting this merged, all good. |
(https://matrix-org.github.io/synapse/develop/usage/administration/admin_api/registration_tokens.html now resolves by the way :) |
@JOJ0 It would be nice to display the expiry time in a human friendly format too (in |
Thanks for your patience. Been busy with music projects and work lately.
You mean adding a new field in the results dict we get from the api response, ie additionally to the "expiry_time" field (eg as in the result shown here: https://matrix-org.github.io/synapse/develop/usage/administration/admin_api/registration_tokens.html#list-all-tokens)? Another option would be to just replace the value in expire_time with a human readable format. But in that case it should be configurable via another --option. Not sure if that's a good idea though. What do you think? And regarding wheather to put it in api.py or cli frontend code, I think since the helper methods are in api.py and possibly api.py could be used standalone theoretically I feel it's ok that the api method can be asked te return human readable or unix timestamp. |
Ooh, music projects :-)
Yeah. I think the timestamp format should at least be available of it is wanted. Maybe by default show human readable only and have an option that shows the timestamp instead? Because in normal use the timestamp will probably just be clutter.
Ok, thanks. |
So you do mean "replacing" the value of expiry_time and not "adding a new additional field" ("expiry_date" or something)? And then have an option switch to control weather the value is a timestamp or an actual date? Did I understand correctly? |
Well to start with I did mean adding a new additional field, but now I think it might be better to replace it and have an option switch. |
Does f0b6e00 look alright? Registration token support has been released in Synapse 1.42.0, so the link to the docs works now. |
Hi, thanks for letting me know that the feature is released now. Upgraded my Synapse and did some testing.
And json output fails because the output renderer can't handle it:
Not sure what's the best way to fix those issues. Let's think about it... |
json and pprint output formats don't automatically convert a python datetime object to a string.
Ah sorry, I only tested with the human output format. Does converting to a string manually as in 323c33d look alright? |
No worries and yes perfect, that probably is the best solution, have a string right away. Also thanks for renaming the variable to readable_expiry, I think that simple change adds to code readability a lot! :-) Otherwise that all looks good and I think we are ready to merge. I found some little things about the show_default flags and posted inline. Something else: I am wondering if there are places in synadm where I should adapt to your nice idea of having an option to choose for output format |
I've removed If I do see any timestamps being output I'll let you know. |
Ah one last thing, you used -t option twice in regtok new command ;-) For --expiry-ts and --token. |
Found one more. This error should be catched/prevented. The output mode doesn't matter:
I guess you could quickly fix that KeyError with a result.get("expiry_time")? |
Hi, I'll merge this now and quickly fix these little things in the master. Thank you so much for this very complete PR, your thoroughness and good communication! May I invite you to #synadm:peek-a-boo.at, we often share opinions about new features and how they could/should be designed. I am sure your presence and thoughts would add some to the community. All the best. Jojo |
Oh, how nice, I spotted your summary page about the feature. Great contribution to Matrix in general. Thanks for that!!! https://calcuode.com/matrix-gsoc/2021-08-22_final-report.html |
Hi, sorry I didn't get round to this, been busy moving to university the past ~week. I am planning to write another blog post now that the synapse part is released and synadm support exists :-) Thanks for your help with this and thanks for synadm, probably see you around in #synadm:peek-a-boo.at |
This adds support for managing registration tokens using the admin API introduced by matrix-org/synapse#10142 which implements MSC3231 - Token Authenticated Registration.
That synapse PR has been merged but isn't part of a release yet, so you probably won't want this until it is.
I'm happy to change names of commands/options/anything if you want.