diff options
author | Erik Johnston <erik@matrix.org> | 2019-03-18 13:17:49 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-03-18 15:51:00 +0000 |
commit | b85ff4b894576d6b35a6985a1812c0affe7aa9bf (patch) | |
tree | 594f8da797334cf63c548858d629a1d0e443e45d /synapse/events | |
parent | Add invite_list and cloning param to create room rule (diff) | |
download | synapse-b85ff4b894576d6b35a6985a1812c0affe7aa9bf.tar.xz |
Add user_may_join_room spam check
Diffstat (limited to 'synapse/events')
-rw-r--r-- | synapse/events/spamcheck.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/synapse/events/spamcheck.py b/synapse/events/spamcheck.py index aa559e1f50..e4fc988cfc 100644 --- a/synapse/events/spamcheck.py +++ b/synapse/events/spamcheck.py @@ -122,3 +122,21 @@ class SpamChecker(object): return True return self.spam_checker.user_may_publish_room(userid, room_id) + + def user_may_join_room(self, userid, room_id, is_invited): + """Checks if a given users is allowed to join a room. + + Is not called when the user creates a room. + + Args: + userid (str) + room_id (str) + is_invited (bool): Whether the user is invited into the room + + Returns: + bool: Whether the user may join the room + """ + if self.spam_checker is None: + return True + + return self.spam_checker.user_may_join_room(userid, room_id, is_invited) |