summary refs log tree commit diff
path: root/synapse/storage/__init__.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-09-26 16:36:24 +0100
committerErik Johnston <erik@matrix.org>2014-09-26 16:36:24 +0100
commit0fdf3088743b25e9fcc39b7b3b4c7f6e8332e26c (patch)
treea5433fb7afa8fb62c65f5a4395c7ed7b1f0a9af4 /synapse/storage/__init__.py
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-0fdf3088743b25e9fcc39b7b3b4c7f6e8332e26c.tar.xz
Track the IP users connect with. Add an admin column to users table.
Diffstat (limited to 'synapse/storage/__init__.py')
-rw-r--r--synapse/storage/__init__.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 15919eb580..d53c090a91 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -63,7 +63,7 @@ SCHEMAS = [
 
 # Remember to update this number every time an incompatible change is made to
 # database schema files, so the users will be informed on server restarts.
-SCHEMA_VERSION = 4
+SCHEMA_VERSION = 5
 
 
 class _RollbackButIsFineException(Exception):
@@ -294,6 +294,16 @@ class DataStore(RoomMemberStore, RoomStore,
 
         defer.returnValue(self.min_token)
 
+    def insert_client_ip(self, user, access_token, ip):
+        return self._simple_insert(
+            "user_ips",
+            {
+                "user": user.to_string(),
+                "access_token": access_token,
+                "ip": ip
+            }
+        )
+
     def snapshot_room(self, room_id, user_id, state_type=None, state_key=None):
         """Snapshot the room for an update by a user
         Args: