mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-09 13:53:03 +02:00
perf(pr977): Remove redundant ACL check in send_join
This commit is contained in:
parent
f47474d12a
commit
d1fff1d09f
1 changed files with 2 additions and 7 deletions
|
@ -56,8 +56,10 @@ async fn create_join_event(
|
||||||
|
|
||||||
// We do not add the event_id field to the pdu here because of signature and
|
// We do not add the event_id field to the pdu here because of signature and
|
||||||
// hashes checks
|
// hashes checks
|
||||||
|
trace!("Getting room version");
|
||||||
let room_version_id = services.rooms.state.get_room_version(room_id).await?;
|
let room_version_id = services.rooms.state.get_room_version(room_id).await?;
|
||||||
|
|
||||||
|
trace!("Generating event ID and converting to canonical json");
|
||||||
let Ok((event_id, mut value)) = gen_event_id_canonical_json(pdu, &room_version_id) else {
|
let Ok((event_id, mut value)) = gen_event_id_canonical_json(pdu, &room_version_id) else {
|
||||||
// Event could not be converted to canonical json
|
// Event could not be converted to canonical json
|
||||||
return Err!(Request(BadJson("Could not convert event to canonical json.")));
|
return Err!(Request(BadJson("Could not convert event to canonical json.")));
|
||||||
|
@ -106,7 +108,6 @@ async fn create_join_event(
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACL check sender user server name
|
|
||||||
let sender: OwnedUserId = serde_json::from_value(
|
let sender: OwnedUserId = serde_json::from_value(
|
||||||
value
|
value
|
||||||
.get("sender")
|
.get("sender")
|
||||||
|
@ -116,12 +117,6 @@ async fn create_join_event(
|
||||||
)
|
)
|
||||||
.map_err(|e| err!(Request(BadJson(warn!("sender property is not a valid user ID: {e}")))))?;
|
.map_err(|e| err!(Request(BadJson(warn!("sender property is not a valid user ID: {e}")))))?;
|
||||||
|
|
||||||
services
|
|
||||||
.rooms
|
|
||||||
.event_handler
|
|
||||||
.acl_check(sender.server_name(), room_id)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
// check if origin server is trying to send for another server
|
// check if origin server is trying to send for another server
|
||||||
if sender.server_name() != origin {
|
if sender.server_name() != origin {
|
||||||
return Err!(Request(Forbidden("Not allowed to join on behalf of another server.")));
|
return Err!(Request(Forbidden("Not allowed to join on behalf of another server.")));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue