summary refs log tree commit diff
path: root/synapse/api
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-12-22 10:25:46 +0000
committerMark Haines <mark.haines@matrix.org>2015-12-22 10:25:46 +0000
commit45a9e0ae0c9a4c55d4648802fefe96cc2933304f (patch)
tree50b17b847dadcaf7fb89d886cfb3cc07a47dc488 /synapse/api
parentAdd top level filtering by room id (diff)
downloadsynapse-45a9e0ae0c9a4c55d4648802fefe96cc2933304f.tar.xz
Allow guest access if the user provides a list of rooms in the filter
Diffstat (limited to 'synapse/api')
-rw-r--r--synapse/api/filtering.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py
index 35faa53746..8c8c7b642e 100644
--- a/synapse/api/filtering.py
+++ b/synapse/api/filtering.py
@@ -144,6 +144,9 @@ class FilterCollection(object):
             "include_leave", False
         )
 
+    def list_rooms(self):
+        return self.room_filter.list_rooms()
+
     def timeline_limit(self):
         return self.room_timeline_filter.limit()
 
@@ -176,6 +179,15 @@ class Filter(object):
     def __init__(self, filter_json):
         self.filter_json = filter_json
 
+    def list_rooms(self):
+        """The list of room_id strings this filter restricts the output to
+        or None if the this filter doesn't list the room ids.
+        """
+        if "rooms" in self.filter_json:
+            return list(set(self.filter_json["rooms"]))
+        else:
+            return None
+
     def check(self, event):
         """Checks whether the filter matches the given event.