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 * Admin
- The minimum required Erlang/OTP version is now 19.1 - 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 # Version 19.02
* Admin * Admin

View File

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