diff options
author | David Baker <dave@matrix.org> | 2015-01-28 12:51:05 +0000 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2015-01-28 12:51:05 +0000 |
commit | c291a4d522afef7449311673b3863db5e484b6e8 (patch) | |
tree | f69458797cfba50c33448a7953e34f3527158154 /synapse/api/auth.py | |
parent | Reset badge count to zero when last active time is bumped (diff) | |
parent | Initial cut of a shared base class for REST unit tests (diff) | |
download | synapse-c291a4d522afef7449311673b3863db5e484b6e8.tar.xz |
Merge branch 'develop' into pushers
Conflicts: synapse/handlers/events.py synapse/server.py
Diffstat (limited to 'synapse/api/auth.py')
-rw-r--r-- | synapse/api/auth.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py index e31482cfaa..a342a0e0da 100644 --- a/synapse/api/auth.py +++ b/synapse/api/auth.py @@ -21,6 +21,7 @@ from synapse.api.constants import EventTypes, Membership, JoinRules from synapse.api.errors import AuthError, StoreError, Codes, SynapseError from synapse.util.logutils import log_function from synapse.util.async import run_on_reactor +from synapse.types import UserID import logging @@ -104,7 +105,7 @@ class Auth(object): for event in curr_state: if event.type == EventTypes.Member: try: - if self.hs.parse_userid(event.state_key).domain != host: + if UserID.from_string(event.state_key).domain != host: continue except: logger.warn("state_key not user_id: %s", event.state_key) @@ -337,7 +338,7 @@ class Auth(object): user_info = { "admin": bool(ret.get("admin", False)), "device_id": ret.get("device_id"), - "user": self.hs.parse_userid(ret.get("name")), + "user": UserID.from_string(ret.get("name")), } defer.returnValue(user_info) @@ -461,7 +462,7 @@ class Auth(object): "You are not allowed to set others state" ) else: - sender_domain = self.hs.parse_userid( + sender_domain = UserID.from_string( event.user_id ).domain @@ -496,7 +497,7 @@ class Auth(object): # Validate users for k, v in user_list.items(): try: - self.hs.parse_userid(k) + UserID.from_string(k) except: raise SynapseError(400, "Not a valid user_id: %s" % (k,)) |