summary refs log tree commit diff
path: root/synapse/api/auth.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-03 16:07:21 +0000
committerErik Johnston <erik@matrix.org>2014-12-03 16:07:21 +0000
commit75b4329aaad400abcee4b23e9c88ff845e0d73c7 (patch)
treeb2e947686ad0cf166e9dbcd8a5a3ac50555f862f /synapse/api/auth.py
parentMerge branch 'develop' of github.com:matrix-org/synapse into events_refactor (diff)
downloadsynapse-75b4329aaad400abcee4b23e9c88ff845e0d73c7.tar.xz
WIP for new way of managing events.
Diffstat (limited to 'synapse/api/auth.py')
-rw-r--r--synapse/api/auth.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index 2b0475543d..50d4be113f 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -351,7 +351,7 @@ class Auth(object):
         return self.store.is_server_admin(user)
 
     @defer.inlineCallbacks
-    def add_auth_events(self, event):
+    def get_auth_events(self, event, current_state):
         if event.type == RoomCreateEvent.TYPE:
             event.auth_events = []
             return
@@ -359,19 +359,19 @@ class Auth(object):
         auth_events = []
 
         key = (RoomPowerLevelsEvent.TYPE, "", )
-        power_level_event = event.old_state_events.get(key)
+        power_level_event = current_state.get(key)
 
         if power_level_event:
             auth_events.append(power_level_event.event_id)
 
         key = (RoomJoinRulesEvent.TYPE, "", )
-        join_rule_event = event.old_state_events.get(key)
+        join_rule_event = current_state.get(key)
 
         key = (RoomMemberEvent.TYPE, event.user_id, )
-        member_event = event.old_state_events.get(key)
+        member_event = current_state.get(key)
 
         key = (RoomCreateEvent.TYPE, "", )
-        create_event = event.old_state_events.get(key)
+        create_event = current_state.get(key)
         if create_event:
             auth_events.append(create_event.event_id)
 
@@ -403,7 +403,8 @@ class Auth(object):
             }
             for h in hashes
         ]
-        event.auth_events = zip(auth_events, hashes)
+
+        defer.returnValue(zip(auth_events, hashes))
 
     @log_function
     def _can_send_event(self, event, auth_events):