summary refs log tree commit diff
path: root/synapse/events
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2019-04-16 16:41:01 +0100
committerErik Johnston <erikj@jki.re>2019-04-16 16:41:01 +0100
commite6218e48800a613e6c8f3d008cd90e4a01194fe5 (patch)
treeb60dd24b637723a8cee735d67d80a3be713f89d9 /synapse/events
parentMerge branch 'develop' into dinsic (diff)
downloadsynapse-e6218e48800a613e6c8f3d008cd90e4a01194fe5.tar.xz
[DINSIC] Block internal users from inviting external users to a public room (#5061)
Co-Authored-By: babolivier <contact@brendanabolivier.com>
Diffstat (limited to 'synapse/events')
-rw-r--r--synapse/events/spamcheck.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/events/spamcheck.py b/synapse/events/spamcheck.py
index 93242658ba..b8ccced43b 100644
--- a/synapse/events/spamcheck.py
+++ b/synapse/events/spamcheck.py
@@ -47,7 +47,7 @@ class SpamChecker(object):
         return self.spam_checker.check_event_for_spam(event)
 
     def user_may_invite(self, inviter_userid, invitee_userid, third_party_invite,
-                        room_id, new_room):
+                        room_id, new_room, published_room):
         """Checks if a given user may send an invite
 
         If this method returns false, the invite will be rejected.
@@ -60,9 +60,12 @@ class SpamChecker(object):
             third_party_invite (dict|None): If a third party invite then is a
                 dict containing the medium and address of the invitee.
             room_id (str)
-            new_room (bool): Wether the user is being invited to the room as
+            new_room (bool): Whether the user is being invited to the room as
                 part of a room creation, if so the invitee would have been
                 included in the call to `user_may_create_room`.
+            published_room (bool): Whether the room the user is being invited
+                to has been published in the local homeserver's public room
+                directory.
 
         Returns:
             bool: True if the user may send an invite, otherwise False
@@ -72,6 +75,7 @@ class SpamChecker(object):
 
         return self.spam_checker.user_may_invite(
             inviter_userid, invitee_userid, third_party_invite, room_id, new_room,
+            published_room,
         )
 
     def user_may_create_room(self, userid, invite_list, third_party_invite_list,