mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-08 06:41:57 +00:00
block event creation and room creation on hitting resource limits
This commit is contained in:
parent
b4d6db5c4a
commit
372bf073c1
@ -276,10 +276,14 @@ class EventCreationHandler(object):
|
|||||||
where *hashes* is a map from algorithm to hash.
|
where *hashes* is a map from algorithm to hash.
|
||||||
|
|
||||||
If None, they will be requested from the database.
|
If None, they will be requested from the database.
|
||||||
|
Raises:
|
||||||
|
ResourceLimitError if server is blocked to some resource being
|
||||||
|
exceeded
|
||||||
Returns:
|
Returns:
|
||||||
Tuple of created event (FrozenEvent), Context
|
Tuple of created event (FrozenEvent), Context
|
||||||
"""
|
"""
|
||||||
|
yield self.auth.check_auth_blocking(requester.user.to_string())
|
||||||
|
|
||||||
builder = self.event_builder_factory.new(event_dict)
|
builder = self.event_builder_factory.new(event_dict)
|
||||||
|
|
||||||
self.validator.validate_new(builder)
|
self.validator.validate_new(builder)
|
||||||
|
@ -98,9 +98,13 @@ class RoomCreationHandler(BaseHandler):
|
|||||||
Raises:
|
Raises:
|
||||||
SynapseError if the room ID couldn't be stored, or something went
|
SynapseError if the room ID couldn't be stored, or something went
|
||||||
horribly wrong.
|
horribly wrong.
|
||||||
|
ResourceLimitError if server is blocked to some resource being
|
||||||
|
exceeded
|
||||||
"""
|
"""
|
||||||
user_id = requester.user.to_string()
|
user_id = requester.user.to_string()
|
||||||
|
|
||||||
|
self.auth.check_auth_blocking(user_id)
|
||||||
|
|
||||||
if not self.spam_checker.user_may_create_room(user_id):
|
if not self.spam_checker.user_may_create_room(user_id):
|
||||||
raise SynapseError(403, "You are not permitted to create rooms")
|
raise SynapseError(403, "You are not permitted to create rooms")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user