mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 07:24:49 -04:00
Add room creation checks to spam checker
Lets the spam checker deny attempts to create rooms and add aliases to them.
This commit is contained in:
parent
5f20a91fa1
commit
197c14dbcf
3 changed files with 47 additions and 0 deletions
|
@ -60,6 +60,11 @@ class RoomCreationHandler(BaseHandler):
|
|||
},
|
||||
}
|
||||
|
||||
def __init__(self, hs):
|
||||
super(RoomCreationHandler, self).__init__(hs)
|
||||
|
||||
self.spam_checker = hs.get_spam_checker()
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def create_room(self, requester, config, ratelimit=True):
|
||||
""" Creates a new room.
|
||||
|
@ -75,6 +80,9 @@ class RoomCreationHandler(BaseHandler):
|
|||
"""
|
||||
user_id = requester.user.to_string()
|
||||
|
||||
if not self.spam_checker.user_may_create_room(user_id):
|
||||
raise SynapseError(403, "You are not permitted to create rooms")
|
||||
|
||||
if ratelimit:
|
||||
yield self.ratelimit(requester)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue