add command to set the allow registration status #902

Open
rmsthebest wants to merge 1 commit from toggle_allow_register into next

View file

@ -153,6 +153,10 @@ enum AdminCommand {
password: Option<String>,
},
/// Set true to allow new users to register.
/// This setting does not persist restarts, for that use the config
AllowRegistration(bool),
/// Disables incoming federation handling for a room.
DisableRoom { room_id: Box<RoomId> },
/// Enables incoming federation handling for a room again.
@ -644,6 +648,12 @@ impl Service {
"Created user with user_id: {user_id} and password: {password}"
))
}
AdminCommand::AllowRegistration(status) => {
services().globals.config.allow_registration = status;
RoomMessageEventContent::text_plain(format!(
"Updated allow registration status: {status}"
))
}
AdminCommand::DisableRoom { room_id } => {
services().rooms.metadata.disable_room(&room_id, true)?;
RoomMessageEventContent::text_plain("Room disabled.")