diff options
author | Badlop <badlop@process-one.net> | 2020-05-05 19:20:22 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2020-05-06 14:08:40 +0200 |
commit | d8509aec123e05f654b764807a963ff480b0e519 (patch) | |
tree | 8641ebefd51ddf69b7c0406e095438f7337b93ac /src | |
parent | ejabberd_listener: Let supervisor terminate child (diff) |
Remove access_commands useless lines, api_permission replaced it years ago
Diffstat (limited to 'src')
-rw-r--r-- | src/ejabberd_xmlrpc.erl | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/ejabberd_xmlrpc.erl b/src/ejabberd_xmlrpc.erl index 31718904a..093bd8483 100644 --- a/src/ejabberd_xmlrpc.erl +++ b/src/ejabberd_xmlrpc.erl @@ -42,8 +42,7 @@ -include("xmpp.hrl"). -record(state, - {access_commands = [] :: list(), - auth = noauth :: noauth | map(), + {auth = noauth :: noauth | map(), get_auth = true :: boolean(), ip :: inet:ip_address()}). @@ -66,10 +65,9 @@ accept(Pid) -> %% HTTP interface %% ----------------------------- -process(_, #request{method = 'POST', data = Data, opts = Opts, ip = {IP, _}}) -> - AccessCommands = proplists:get_value(access_commands, Opts, []), +process(_, #request{method = 'POST', data = Data, ip = {IP, _}}) -> GetAuth = true, - State = #state{access_commands = AccessCommands, get_auth = GetAuth, ip = IP}, + State = #state{get_auth = GetAuth, ip = IP}, case fxml_stream:parse_element(Data) of {error, _} -> {400, [], @@ -190,8 +188,7 @@ handler(State, {call, Command, []}) -> handler(State, {call, Command, [{struct, AttrL}]}) -> {ArgsF, ArgsR, ResultF} = ejabberd_commands:get_command_format(Command, State#state.auth), - try_do_command(State#state.access_commands, - State#state.auth, Command, AttrL, ArgsF, ArgsR, ResultF); + try_do_command(State#state.auth, Command, AttrL, ArgsF, ArgsR, ResultF); handler(_State, Payload) -> build_fault_response(-112, "Unknown call: ~p", [Payload]). @@ -200,10 +197,8 @@ handler(_State, Payload) -> %% Command %% ----------------------------- -try_do_command(AccessCommands, Auth, Command, AttrL, - ArgsF, ArgsR, ResultF) -> - try do_command(AccessCommands, Auth, Command, AttrL, - ArgsF, ArgsR, ResultF) +try_do_command(Auth, Command, AttrL, ArgsF, ArgsR, ResultF) -> + try do_command(Auth, Command, AttrL, ArgsF, ArgsR, ResultF) of {command_result, ResultFormatted} -> {false, {response, [ResultFormatted]}} @@ -238,11 +233,10 @@ build_fault_response(Code, ParseString, ParseArgs) -> ?WARNING_MSG(FaultString, []), {false, {response, {fault, Code, list_to_binary(FaultString)}}}. -do_command(AccessCommands, Auth, Command, AttrL, ArgsF, ArgsR, +do_command(Auth, Command, AttrL, ArgsF, ArgsR, ResultF) -> ArgsFormatted = format_args(rename_old_args(AttrL, ArgsR), ArgsF), - Auth2 = Auth#{extra_permissions => AccessCommands}, - Result = ejabberd_commands:execute_command2(Command, ArgsFormatted, Auth2), + Result = ejabberd_commands:execute_command2(Command, ArgsFormatted, Auth), ResultFormatted = format_result(Result, ResultF), {command_result, ResultFormatted}. |