mirror of
https://forgejo.ellis.link/continuwuation/continuwuity/
synced 2026-03-29 16:40:00 +00:00
fix(rooms): prevent removing admin room alias
Only the server user can now remove the #admins alias, matching the existing check for setting the alias. This prevents users from accidentally breaking the admin room functionality. fixes #1408
This commit is contained in:
committed by
Ellis Git
parent
22a47d1e59
commit
80c9bb4796
@@ -94,6 +94,12 @@ pub fn set_alias(
|
||||
|
||||
#[tracing::instrument(skip(self))]
|
||||
pub async fn remove_alias(&self, alias: &RoomAliasId, user_id: &UserId) -> Result<()> {
|
||||
if alias == self.services.globals.admin_alias
|
||||
&& user_id != self.services.globals.server_user
|
||||
{
|
||||
return Err!(Request(Forbidden("Only the server user can remove this alias")));
|
||||
}
|
||||
|
||||
if !self.user_can_remove_alias(alias, user_id).await? {
|
||||
return Err!(Request(Forbidden("User is not permitted to remove this alias.")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user