25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

allow room recreate for admins even if nonempty

This commit is contained in:
Christoph Scholz 2019-03-01 21:41:53 +01:00
parent a4222fe9b3
commit b5fa3b0e2b
2 changed files with 9 additions and 3 deletions

View File

@ -3,6 +3,9 @@
* Admin
- The minimum required Erlang/OTP version is now 19.1
* MUC
- Service admins are allowed to recreate room even if archiv is nonempty
# Version 19.02
* Admin

View File

@ -438,18 +438,21 @@ do_route1(_Host, _ServerHost, _Access, _HistorySize, _RoomShaper,
ejabberd_router:route_error(Packet, Err);
do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
From, To, Packet, DefRoomOpts, QueueType) ->
{_AccessRoute, AccessCreate, _AccessAdmin, _AccessPersistent, _AccessMam} = Access,
{_AccessRoute, AccessCreate, AccessAdmin, _AccessPersistent, _AccessMam} = Access,
{Room, _, Nick} = jid:tolower(To),
RMod = gen_mod:ram_db_mod(ServerHost, ?MODULE),
case RMod:find_online_room(ServerHost, Room, Host) of
error ->
case is_create_request(Packet) of
true ->
IsServiceAdmin = acl:match_rule(ServerHost,
AccessAdmin, From) == allow,
case check_user_can_create_room(
ServerHost, AccessCreate, From, Room) and
(IsServiceAdmin orelse
ejabberd_hooks:run_fold(check_create_room,
ServerHost, true,
[ServerHost, Room, Host]) of
[ServerHost, Room, Host])) of
true ->
{ok, Pid} = start_new_room(
Host, ServerHost, Access,