summary refs log tree commit diff
path: root/synapse/handlers/register.py
diff options
context:
space:
mode:
authorKegan Dougal <kegan@matrix.org>2015-02-27 13:51:41 +0000
committerKegan Dougal <kegan@matrix.org>2015-02-27 13:51:41 +0000
commit58ff0660642e6ef8f9fe5672fb50e5d75a569479 (patch)
tree4c1ec2625e6a96ef8a3ebf1d0d6a135b8606ad70 /synapse/handlers/register.py
parentAdd more unit tests for exclusive namespaces. (diff)
downloadsynapse-58ff0660642e6ef8f9fe5672fb50e5d75a569479.tar.xz
Implement exclusive namespace checks.
Diffstat (limited to 'synapse/handlers/register.py')
-rw-r--r--synapse/handlers/register.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py
index 516a936cee..cda4a8502a 100644
--- a/synapse/handlers/register.py
+++ b/synapse/handlers/register.py
@@ -201,11 +201,12 @@ class RegistrationHandler(BaseHandler):
         interested_services = [
             s for s in services if s.is_interested_in_user(user_id)
         ]
-        if len(interested_services) > 0:
-            raise SynapseError(
-                400, "This user ID is reserved by an application service.",
-                errcode=Codes.EXCLUSIVE
-            )
+        for service in interested_services:
+            if service.is_exclusive_user(user_id):
+                raise SynapseError(
+                    400, "This user ID is reserved by an application service.",
+                    errcode=Codes.EXCLUSIVE
+                )
 
     def _generate_token(self, user_id):
         # urlsafe variant uses _ and - so use . as the separator and replace