Implement admin check and add config option for allowing room creation
This commit is contained in:
parent
47f3263396
commit
6bc8fb2ae7
4 changed files with 34 additions and 1 deletions
|
@ -61,6 +61,16 @@ pub async fn create_room_route(
|
|||
);
|
||||
let state_lock = mutex_state.lock().await;
|
||||
|
||||
if !db.globals.allow_room_creation()
|
||||
&& !body.from_appservice
|
||||
&& !db.users.is_admin(sender_user, &db.rooms, &db.globals)?
|
||||
{
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::Forbidden,
|
||||
"Room creation has been disabled.",
|
||||
));
|
||||
}
|
||||
|
||||
let alias: Option<RoomAliasId> =
|
||||
body.room_alias_name
|
||||
.as_ref()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue