diff options
author | David Baker <dave@matrix.org> | 2017-10-03 13:53:09 +0100 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2017-10-03 13:56:43 +0100 |
commit | 84716d267c6d93cfe759e8da336efb3136dc1560 (patch) | |
tree | d9f4653e58a51066121d4e965c185dfe3cba1ae4 /synapse/handlers/federation.py | |
parent | Merge pull request #2491 from matrix-org/rav/port_db_fixes (diff) | |
download | synapse-84716d267c6d93cfe759e8da336efb3136dc1560.tar.xz |
Allow spam checker to reject invites too
Diffstat (limited to 'synapse/handlers/federation.py')
-rw-r--r-- | synapse/handlers/federation.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 18f87cad67..32078fde3c 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -77,6 +77,7 @@ class FederationHandler(BaseHandler): self.action_generator = hs.get_action_generator() self.is_mine_id = hs.is_mine_id self.pusher_pool = hs.get_pusherpool() + self.spam_checker = hs.get_spam_checker() self.replication_layer.set_handler(self) @@ -1077,6 +1078,9 @@ class FederationHandler(BaseHandler): if self.hs.config.block_non_admin_invites: raise SynapseError(403, "This server does not accept room invites") + if not self.spam_checker.user_may_invite(requester.user): + raise SynapseError(403, "This user is not permitted to send invites to this server") + membership = event.content.get("membership") if event.type != EventTypes.Member or membership != Membership.INVITE: raise SynapseError(400, "The event was not an m.room.member invite event") |