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

Deprecated access_commands option

This commit is contained in:
Evgeny Khramtsov 2019-06-24 17:20:29 +03:00
parent 1d239ec6fb
commit db9e8220ec
2 changed files with 13 additions and 18 deletions

View File

@ -224,6 +224,8 @@ transform_request_handlers(Opts) ->
case lists:keyfind(module, 1, Opts) of case lists:keyfind(module, 1, Opts) of
{_, ejabberd_http} -> {_, ejabberd_http} ->
replace_request_handlers(Opts); replace_request_handlers(Opts);
{_, ejabberd_xmlrpc} ->
remove_xmlrpc_access_commands(Opts);
_ -> _ ->
Opts Opts
end. end.
@ -279,6 +281,15 @@ replace_request_handlers(Opts) ->
(_) -> true (_) -> true
end, Opts). end, Opts).
remove_xmlrpc_access_commands(Opts) ->
lists:filter(
fun({access_commands, _}) ->
warn_removed_option(access_commands, api_permissions),
false;
(_) ->
true
end, Opts).
remove_inet_options(Opts) -> remove_inet_options(Opts) ->
lists:filter( lists:filter(
fun({Opt, _}) when Opt == inet; Opt == inet6 -> fun({Opt, _}) when Opt == inet; Opt == inet6 ->

View File

@ -36,7 +36,7 @@
-author('badlop@process-one.net'). -author('badlop@process-one.net').
-export([start/3, start_link/3, handler/2, process/2, accept/1, -export([start/3, start_link/3, handler/2, process/2, accept/1,
listen_opt_type/1, listen_options/0]). listen_options/0]).
-include("logger.hrl"). -include("logger.hrl").
-include("ejabberd_http.hrl"). -include("ejabberd_http.hrl").
@ -554,21 +554,5 @@ make_status(false) -> 1;
make_status(error) -> 1; make_status(error) -> 1;
make_status(_) -> 1. make_status(_) -> 1.
listen_opt_type(access_commands) ->
fun(Opts) ->
lists:map(
fun({Ac, AcOpts}) ->
Commands = case proplists:get_value(
commands, lists:flatten(AcOpts), all) of
Cmd when is_atom(Cmd) -> Cmd;
Cmds when is_list(Cmds) ->
true = lists:all(fun is_atom/1, Cmds),
Cmds
end,
{<<"ejabberd_xmlrpc compatibility shim">>,
{[?MODULE], [{access, Ac}], Commands}}
end, lists:flatten(Opts))
end.
listen_options() -> listen_options() ->
[{access_commands, []}]. [].