summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2017-10-03 18:10:23 +0100
committerGitHub <noreply@github.com>2017-10-03 18:10:23 +0100
commit5f20a91fa1e74794c34ba47415e47d3b07be37af (patch)
tree1ac5c80af280727951f6385d88890623a2be2c26 /synapse/events
parentMerge pull request #2491 from matrix-org/rav/port_db_fixes (diff)
parents/roomid/room_id/ (diff)
downloadsynapse-5f20a91fa1e74794c34ba47415e47d3b07be37af.tar.xz
Merge pull request #2492 from matrix-org/dbkr/spam_check_invites
Allow spam checker to reject invites too
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/spamcheck.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/events/spamcheck.py b/synapse/events/spamcheck.py
index e739f105b2..8b01c091e9 100644
--- a/synapse/events/spamcheck.py
+++ b/synapse/events/spamcheck.py
@@ -45,3 +45,19 @@ class SpamChecker(object):
             return False
 
         return self.spam_checker.check_event_for_spam(event)
+
+    def user_may_invite(self, userid, room_id):
+        """Checks if a given user may send an invite
+
+        If this method returns false, the invite will be rejected.
+
+        Args:
+            userid (string): The sender's user ID
+
+        Returns:
+            bool: True if the user may send an invite, otherwise False
+        """
+        if self.spam_checker is None:
+            return True
+
+        return self.spam_checker.user_may_invite(userid, room_id)