]> granicus.if.org Git - ejabberd/commitdiff
allow room recreate for admins even if nonempty
authorChristoph Scholz <christoph.scholz@gmail.com>
Fri, 1 Mar 2019 20:41:53 +0000 (21:41 +0100)
committerChristoph Scholz <christoph.scholz@gmail.com>
Tue, 5 Mar 2019 15:51:57 +0000 (16:51 +0100)
CHANGELOG.md
src/mod_muc.erl

index 07bc3791b6fd8b405b338c2bac6be09f3fd9cb7b..321b08d676f5721b469bb92543adf59e1b80e10a 100644 (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
index 9d53b89749ccbf9d0d7998feb811f8089bb4a057..96b73891d14a0aaa73642b4ddd1597a9a486aa18 100644 (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
-                       ejabberd_hooks:run_fold(check_create_room,
+                               (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,