Skip to content
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

Support MSC2140 register/terms endpoints #200

Merged
merged 16 commits into from Aug 22, 2019

Conversation

@dbkr
Copy link
Member

commented Aug 22, 2019

  • Account endpoints for registering / logging out
  • Terms endpoints to get & accept terms
  • Deferjsonwrap used in the register endpoint

This is still large-ish, it could be split up into register/logout and terms but then there'd be two database versions rather than one.

 * Account endpoints for registering / logging out
 * Terms endpoints to get & accept terms
 * Deferjsonwrap used in the register endpoint
@dbkr dbkr requested a review from matrix-org/synapse-core Aug 22, 2019
dbkr added 2 commits Aug 22, 2019
@dbkr dbkr referenced this pull request Aug 22, 2019
Copy link
Member

left a comment

Looks mostly fine, other than docstrings please 😇

Also, doesn't the rest of sydent use snake case?

sydent/db/accounts.py Outdated Show resolved Hide resolved
sydent/db/terms.py Outdated Show resolved Hide resolved
sydent/db/terms.py Outdated Show resolved Hide resolved
sydent/http/auth.py Outdated Show resolved Hide resolved
sydent/http/auth.py Outdated Show resolved Hide resolved
sydent/terms/terms.py Outdated Show resolved Hide resolved
def __init__(self, user_id, creation_ts, consent_version):
self.userId = user_id
self.creationTs = creation_ts;
self.consentVersion = consent_version

This comment has been minimized.

Copy link
@erikjohnston

erikjohnston Aug 22, 2019

Member

fwiw attrs is a great library for this:

@attr.s
class Account(object):
    user_id = attr.ib()
    creation_ts = attr.ib()
    consent_version = attr.ib()

its not such a big thing here, but makes it very easy to then make it a frozen object or whatever.


logger = logging.getLogger(__name__)

def getUserByToken(sydent, token):

This comment has been minimized.

Copy link
@erikjohnston

erikjohnston Aug 22, 2019

Member

What happened to the rest of the function?

This comment has been minimized.

Copy link
@dbkr

dbkr Aug 22, 2019

Author Member

um, yeah, guess I decided not to have the file in the end...

terms.sample.yaml Show resolved Hide resolved
sydent/db/accounts.py Outdated Show resolved Hide resolved
dbkr and others added 10 commits Aug 22, 2019
Co-Authored-By: Erik Johnston <erik@matrix.org>
so it can use the conn pool
Co-Authored-By: Erik Johnston <erik@matrix.org>
Co-Authored-By: Erik Johnston <erik@matrix.org>
Co-Authored-By: Erik Johnston <erik@matrix.org>
401
Co-Authored-By: Erik Johnston <erik@matrix.org>
@dbkr dbkr requested a review from erikjohnston Aug 22, 2019
Copy link
Member

left a comment

Just a few final nits

sydent/http/servlets/__init__.py Outdated Show resolved Hide resolved
logger.error("Request processing failed: %r, %s", failure, failure.getTraceback())
request.setResponseCode(500)
request.write(json.dumps({'errcode': 'M_UNKNOWN', 'error': 'Internal Server Error'}))
request.finish()

This comment has been minimized.

Copy link
@erikjohnston

erikjohnston Aug 22, 2019

Member

Ok, fair enough.

sydent/http/auth.py Show resolved Hide resolved
sydent/http/auth.py Show resolved Hide resolved
sydent/terms/terms.py Show resolved Hide resolved

logger = logging.getLogger(__name__)

def issueToken(sydent, user_id):

This comment has been minimized.

Copy link
@erikjohnston

erikjohnston Aug 22, 2019

Member

Any reason this is not part of the account store?

This comment has been minimized.

Copy link
@dbkr

dbkr Aug 22, 2019

Author Member

Just that the actual issuing of a token seemed beyond the remit of the store, ie. the store should just be doing the storing. (Although in this case I'll grant you that the only difference is making up some random letters).

dbkr and others added 2 commits Aug 22, 2019
Co-Authored-By: Erik Johnston <erik@matrix.org>
doc
@dbkr dbkr requested a review from erikjohnston Aug 22, 2019
@dbkr dbkr merged commit dcda2dc into master Aug 22, 2019
1 check passed
1 check passed
buildkite/sydent Build #101 passed (27 seconds)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.