summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-10-25 15:25:21 +0100
committerErik Johnston <erik@matrix.org>2018-10-25 15:25:21 +0100
commite5481b22aac800b016e05f50a50ced85a226b364 (patch)
tree4fa4dfed6d4154e61a71205fdfd098d1aae989f6
parentUse match rather than search (diff)
downloadsynapse-e5481b22aac800b016e05f50a50ced85a226b364.tar.xz
Use allow/deny
-rw-r--r--synapse/config/room_directory.py12
-rw-r--r--tests/config/test_room_directory.py8
-rw-r--r--tests/handlers/test_directory.py2
3 files changed, 11 insertions, 11 deletions
diff --git a/synapse/config/room_directory.py b/synapse/config/room_directory.py
index 2ca010afdb..9da13ab11b 100644
--- a/synapse/config/room_directory.py
+++ b/synapse/config/room_directory.py
@@ -35,13 +35,13 @@ class RoomDirectoryConfig(Config):
         # The format of this option is a list of rules that contain globs that
         # match against user_id and the new alias (fully qualified with server
         # name). The action in the first rule that matches is taken, which can
-        # currently either be "allowed" or "denied".
+        # currently either be "allow" or "deny".
         #
         # If no rules match the request is denied.
         alias_creation_rules:
             - user_id: "*"
               alias: "*"
-              action: allowed
+              action: allow
         """
 
     def is_alias_creation_allowed(self, user_id, alias):
@@ -56,7 +56,7 @@ class RoomDirectoryConfig(Config):
         """
         for rule in self._alias_creation_rules:
             if rule.matches(user_id, alias):
-                return rule.action == "allowed"
+                return rule.action == "allow"
 
         return False
 
@@ -67,12 +67,12 @@ class _AliasRule(object):
         user_id = rule["user_id"]
         alias = rule["alias"]
 
-        if action in ("allowed", "denied"):
+        if action in ("allow", "deny"):
             self.action = action
         else:
             raise ConfigError(
-                "alias_creation_rules rules can only have action of 'allowed'"
-                " or 'denied'"
+                "alias_creation_rules rules can only have action of 'allow'"
+                " or 'deny'"
             )
 
         try:
diff --git a/tests/config/test_room_directory.py b/tests/config/test_room_directory.py
index 75021a5f04..f37a17d618 100644
--- a/tests/config/test_room_directory.py
+++ b/tests/config/test_room_directory.py
@@ -26,16 +26,16 @@ class RoomDirectoryConfigTestCase(unittest.TestCase):
         alias_creation_rules:
             - user_id: "*bob*"
               alias: "*"
-              action: "denied"
+              action: "deny"
             - user_id: "*"
               alias: "#unofficial_*"
-              action: "allowed"
+              action: "allow"
             - user_id: "@foo*:example.com"
               alias: "*"
-              action: "allowed"
+              action: "allow"
             - user_id: "@gah:example.com"
               alias: "#goo:example.com"
-              action: "allowed"
+              action: "allow"
         """)
 
         rd_config = RoomDirectoryConfig()
diff --git a/tests/handlers/test_directory.py b/tests/handlers/test_directory.py
index 4f299b74ba..8ae6556c0a 100644
--- a/tests/handlers/test_directory.py
+++ b/tests/handlers/test_directory.py
@@ -118,7 +118,7 @@ class TestCreateAliasACL(unittest.HomeserverTestCase):
             {
                 "user_id": "*",
                 "alias": "#unofficial_*",
-                "action": "allowed",
+                "action": "allow",
             }
         ]