mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-15 22:42:23 +01:00
Check against sender rather than event_id
This commit is contained in:
parent
a88e16152f
commit
b345853918
2 changed files with 4 additions and 4 deletions
|
@ -20,7 +20,7 @@ from twisted.internet import defer
|
||||||
from synapse.api.constants import EventTypes, Membership, JoinRules
|
from synapse.api.constants import EventTypes, Membership, JoinRules
|
||||||
from synapse.api.errors import AuthError, Codes, SynapseError
|
from synapse.api.errors import AuthError, Codes, SynapseError
|
||||||
from synapse.util.logutils import log_function
|
from synapse.util.logutils import log_function
|
||||||
from synapse.types import EventID, RoomID, UserID
|
from synapse.types import RoomID, UserID
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -66,10 +66,10 @@ class Auth(object):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
creating_domain = RoomID.from_string(event.room_id).domain
|
creating_domain = RoomID.from_string(event.room_id).domain
|
||||||
originating_domain = EventID.from_string(event.event_id).domain
|
originating_domain = UserID.from_string(event.sender).domain
|
||||||
if creating_domain != originating_domain:
|
if creating_domain != originating_domain:
|
||||||
if not self.can_federate(event, auth_events):
|
if not self.can_federate(event, auth_events):
|
||||||
raise SynapseError(
|
raise AuthError(
|
||||||
403,
|
403,
|
||||||
"This room has been marked as unfederatable."
|
"This room has been marked as unfederatable."
|
||||||
)
|
)
|
||||||
|
|
|
@ -35,7 +35,7 @@ def create_event(name=None, type=None, state_key=None, depth=2, event_id=None,
|
||||||
|
|
||||||
if not event_id:
|
if not event_id:
|
||||||
_next_event_id += 1
|
_next_event_id += 1
|
||||||
event_id = str(_next_event_id)
|
event_id = "$%s:test" % (_next_event_id,)
|
||||||
|
|
||||||
if not name:
|
if not name:
|
||||||
if state_key is not None:
|
if state_key is not None:
|
||||||
|
|
Loading…
Reference in a new issue