mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-03 18:02:28 +01:00
Reuse some translation strings
This commit is contained in:
parent
adfb924808
commit
d7250111ce
@ -411,7 +411,7 @@ bind(R, #{user := U, server := S, access := Access, lang := Lang,
|
|||||||
ejabberd_hooks:run(forbidden_session_hook, LServer, [JID]),
|
ejabberd_hooks:run(forbidden_session_hook, LServer, [JID]),
|
||||||
?INFO_MSG("(~s) Forbidden c2s session for ~s",
|
?INFO_MSG("(~s) Forbidden c2s session for ~s",
|
||||||
[SockMod:pp(Socket), jid:encode(JID)]),
|
[SockMod:pp(Socket), jid:encode(JID)]),
|
||||||
Txt = <<"Denied by ACL">>,
|
Txt = <<"Access denied by service policy">>,
|
||||||
{error, xmpp:err_not_allowed(Txt, Lang), State}
|
{error, xmpp:err_not_allowed(Txt, Lang), State}
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
@ -658,7 +658,7 @@ process_presence_out(#{user := User, server := Server, lserver := LServer,
|
|||||||
MyBareJID = jid:remove_resource(JID),
|
MyBareJID = jid:remove_resource(JID),
|
||||||
case acl:match_rule(LServer, Access, MyBareJID) of
|
case acl:match_rule(LServer, Access, MyBareJID) of
|
||||||
deny ->
|
deny ->
|
||||||
ErrText = <<"Denied by ACL">>,
|
ErrText = <<"Access denied by service policy">>,
|
||||||
Err = xmpp:err_forbidden(ErrText, Lang),
|
Err = xmpp:err_forbidden(ErrText, Lang),
|
||||||
send_error(State, Pres, Err);
|
send_error(State, Pres, Err);
|
||||||
allow ->
|
allow ->
|
||||||
|
@ -369,7 +369,7 @@ do_route(Packet) ->
|
|||||||
<<"Server connections to local "
|
<<"Server connections to local "
|
||||||
"subdomains are forbidden">>, Lang);
|
"subdomains are forbidden">>, Lang);
|
||||||
forbidden ->
|
forbidden ->
|
||||||
xmpp:err_forbidden(<<"Denied by ACL">>, Lang);
|
xmpp:err_forbidden(<<"Access denied by service policy">>, Lang);
|
||||||
internal_server_error ->
|
internal_server_error ->
|
||||||
xmpp:err_internal_server_error()
|
xmpp:err_internal_server_error()
|
||||||
end,
|
end,
|
||||||
|
@ -199,7 +199,7 @@ handle_info({route, Packet}, #{access := Access} = State) ->
|
|||||||
xmpp_stream_in:send(State, Packet);
|
xmpp_stream_in:send(State, Packet);
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
Lang = xmpp:get_lang(Packet),
|
||||||
Err = xmpp:err_not_allowed(<<"Denied by ACL">>, Lang),
|
Err = xmpp:err_not_allowed(<<"Access denied by service policy">>, Lang),
|
||||||
ejabberd_router:route_error(Packet, Err),
|
ejabberd_router:route_error(Packet, Err),
|
||||||
State
|
State
|
||||||
end;
|
end;
|
||||||
|
@ -237,7 +237,7 @@ disco_identity(Acc, _From, _To, Node, Lang) ->
|
|||||||
-define(INFO_RESULT(Allow, Feats, Lang),
|
-define(INFO_RESULT(Allow, Feats, Lang),
|
||||||
case Allow of
|
case Allow of
|
||||||
deny ->
|
deny ->
|
||||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||||
allow ->
|
allow ->
|
||||||
{result, Feats}
|
{result, Feats}
|
||||||
end).
|
end).
|
||||||
@ -252,7 +252,7 @@ disco_features(Acc, From, #jid{lserver = LServer} = _To, <<"announce">>, Lang) -
|
|||||||
case {acl:match_rule(LServer, Access1, From),
|
case {acl:match_rule(LServer, Access1, From),
|
||||||
acl:match_rule(global, Access2, From)} of
|
acl:match_rule(global, Access2, From)} of
|
||||||
{deny, deny} ->
|
{deny, deny} ->
|
||||||
Txt = <<"Denied by ACL">>,
|
Txt = <<"Access denied by service policy">>,
|
||||||
{error, xmpp:err_forbidden(Txt, Lang)};
|
{error, xmpp:err_forbidden(Txt, Lang)};
|
||||||
_ ->
|
_ ->
|
||||||
{result, []}
|
{result, []}
|
||||||
@ -303,7 +303,7 @@ disco_features(Acc, From, #jid{lserver = LServer} = _To, Node, Lang) ->
|
|||||||
-define(ITEMS_RESULT(Allow, Items, Lang),
|
-define(ITEMS_RESULT(Allow, Items, Lang),
|
||||||
case Allow of
|
case Allow of
|
||||||
deny ->
|
deny ->
|
||||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||||
allow ->
|
allow ->
|
||||||
{result, Items}
|
{result, Items}
|
||||||
end).
|
end).
|
||||||
@ -417,7 +417,7 @@ commands_result(Allow, From, To, Request) ->
|
|||||||
case Allow of
|
case Allow of
|
||||||
deny ->
|
deny ->
|
||||||
Lang = Request#adhoc_command.lang,
|
Lang = Request#adhoc_command.lang,
|
||||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||||
allow ->
|
allow ->
|
||||||
announce_commands(From, To, Request)
|
announce_commands(From, To, Request)
|
||||||
end.
|
end.
|
||||||
@ -843,7 +843,7 @@ add_store_hint(El) ->
|
|||||||
-spec route_forbidden_error(stanza()) -> ok.
|
-spec route_forbidden_error(stanza()) -> ok.
|
||||||
route_forbidden_error(Packet) ->
|
route_forbidden_error(Packet) ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
Lang = xmpp:get_lang(Packet),
|
||||||
Err = xmpp:err_forbidden(<<"Denied by ACL">>, Lang),
|
Err = xmpp:err_forbidden(<<"Access denied by service policy">>, Lang),
|
||||||
ejabberd_router:route_error(Packet, Err).
|
ejabberd_router:route_error(Packet, Err).
|
||||||
|
|
||||||
-spec init_cache(module(), binary(), gen_mod:opts()) -> ok.
|
-spec init_cache(module(), binary(), gen_mod:opts()) -> ok.
|
||||||
|
@ -192,7 +192,7 @@ get_local_identity(Acc, _From, _To, Node, Lang) ->
|
|||||||
|
|
||||||
-define(INFO_RESULT(Allow, Feats, Lang),
|
-define(INFO_RESULT(Allow, Feats, Lang),
|
||||||
case Allow of
|
case Allow of
|
||||||
deny -> {error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
deny -> {error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||||
allow -> {result, Feats}
|
allow -> {result, Feats}
|
||||||
end).
|
end).
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ get_sm_items(Acc, From,
|
|||||||
Items ++ Nodes ++ get_user_resources(User, Server)};
|
Items ++ Nodes ++ get_user_resources(User, Server)};
|
||||||
{allow, <<"config">>} -> {result, []};
|
{allow, <<"config">>} -> {result, []};
|
||||||
{_, <<"config">>} ->
|
{_, <<"config">>} ->
|
||||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||||
_ -> Acc
|
_ -> Acc
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
@ -432,7 +432,7 @@ get_local_items(Acc, From, #jid{lserver = LServer} = To,
|
|||||||
_ ->
|
_ ->
|
||||||
LNode = tokenize(Node),
|
LNode = tokenize(Node),
|
||||||
Allow = acl:match_rule(LServer, configure, From),
|
Allow = acl:match_rule(LServer, configure, From),
|
||||||
Err = xmpp:err_forbidden(<<"Denied by ACL">>, Lang),
|
Err = xmpp:err_forbidden(<<"Access denied by service policy">>, Lang),
|
||||||
case LNode of
|
case LNode of
|
||||||
[<<"config">>] ->
|
[<<"config">>] ->
|
||||||
?ITEMS_RESULT(Allow, LNode, {error, Err});
|
?ITEMS_RESULT(Allow, LNode, {error, Err});
|
||||||
@ -765,7 +765,7 @@ get_stopped_nodes(_Lang) ->
|
|||||||
-define(COMMANDS_RESULT(LServerOrGlobal, From, To,
|
-define(COMMANDS_RESULT(LServerOrGlobal, From, To,
|
||||||
Request, Lang),
|
Request, Lang),
|
||||||
case acl:match_rule(LServerOrGlobal, configure, From) of
|
case acl:match_rule(LServerOrGlobal, configure, From) of
|
||||||
deny -> {error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
deny -> {error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||||
allow -> adhoc_local_commands(From, To, Request)
|
allow -> adhoc_local_commands(From, To, Request)
|
||||||
end).
|
end).
|
||||||
|
|
||||||
@ -1737,7 +1737,7 @@ adhoc_sm_commands(_Acc, From,
|
|||||||
action = Action, xdata = XData} = Request) ->
|
action = Action, xdata = XData} = Request) ->
|
||||||
case acl:match_rule(LServer, configure, From) of
|
case acl:match_rule(LServer, configure, From) of
|
||||||
deny ->
|
deny ->
|
||||||
{error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
{error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||||
allow ->
|
allow ->
|
||||||
ActionIsExecute = Action == execute orelse Action == complete,
|
ActionIsExecute = Action == execute orelse Action == complete,
|
||||||
if Action == cancel ->
|
if Action == cancel ->
|
||||||
|
@ -522,7 +522,7 @@ process_slot_request(#iq{lang = Lang, from = From} = IQ,
|
|||||||
deny ->
|
deny ->
|
||||||
?DEBUG("Denying HTTP upload slot request from ~s",
|
?DEBUG("Denying HTTP upload slot request from ~s",
|
||||||
[jid:encode(From)]),
|
[jid:encode(From)]),
|
||||||
Txt = <<"Denied by ACL">>,
|
Txt = <<"Access denied by service policy">>,
|
||||||
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ do_route(Host, ServerHost, Access, Packet) ->
|
|||||||
end;
|
end;
|
||||||
deny ->
|
deny ->
|
||||||
Lang = xmpp:get_lang(Packet),
|
Lang = xmpp:get_lang(Packet),
|
||||||
Err = xmpp:err_forbidden(<<"Denied by ACL">>, Lang),
|
Err = xmpp:err_forbidden(<<"Access denied by service policy">>, Lang),
|
||||||
ejabberd_router:route_error(Packet, Err)
|
ejabberd_router:route_error(Packet, Err)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ authenticate(#{stream_id := StreamID, server := Server,
|
|||||||
Err = xmpp:make_error(IQ, xmpp:err_jid_malformed()),
|
Err = xmpp:make_error(IQ, xmpp:err_jid_malformed()),
|
||||||
process_auth_failure(State, U, Err, 'jid-malformed');
|
process_auth_failure(State, U, Err, 'jid-malformed');
|
||||||
false ->
|
false ->
|
||||||
Txt = <<"Denied by ACL">>,
|
Txt = <<"Access denied by service policy">>,
|
||||||
Err = xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang)),
|
Err = xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang)),
|
||||||
process_auth_failure(State, U, Err, 'forbidden')
|
process_auth_failure(State, U, Err, 'forbidden')
|
||||||
end.
|
end.
|
||||||
|
@ -1059,7 +1059,7 @@ get_roomconfig_text(allow_visitor_status, Lang) ->
|
|||||||
?T(<<"Allow visitors to send status text in "
|
?T(<<"Allow visitors to send status text in "
|
||||||
"presence updates">>);
|
"presence updates">>);
|
||||||
get_roomconfig_text(captcha_protected, Lang) ->
|
get_roomconfig_text(captcha_protected, Lang) ->
|
||||||
?T(<<"Make room captcha protected">>);
|
?T(<<"Make room CAPTCHA protected">>);
|
||||||
get_roomconfig_text(description, Lang) ->
|
get_roomconfig_text(description, Lang) ->
|
||||||
?T(<<"Room description">>);
|
?T(<<"Room description">>);
|
||||||
%% get_roomconfig_text(subject, Lang) -> "Subject";
|
%% get_roomconfig_text(subject, Lang) -> "Subject";
|
||||||
|
@ -183,7 +183,7 @@ process_bytestreams(#iq{type = get, from = JID, to = To, lang = Lang} = IQ) ->
|
|||||||
StreamHost = get_streamhost(Host, ServerHost),
|
StreamHost = get_streamhost(Host, ServerHost),
|
||||||
xmpp:make_iq_result(IQ, #bytestreams{hosts = [StreamHost]});
|
xmpp:make_iq_result(IQ, #bytestreams{hosts = [StreamHost]});
|
||||||
deny ->
|
deny ->
|
||||||
xmpp:make_error(IQ, xmpp:err_forbidden(<<"Denied by ACL">>, Lang))
|
xmpp:make_error(IQ, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang))
|
||||||
end;
|
end;
|
||||||
process_bytestreams(#iq{type = set, lang = Lang,
|
process_bytestreams(#iq{type = set, lang = Lang,
|
||||||
sub_els = [#bytestreams{sid = SID}]} = IQ)
|
sub_els = [#bytestreams{sid = SID}]} = IQ)
|
||||||
@ -232,7 +232,7 @@ process_bytestreams(#iq{type = set, lang = Lang, from = InitiatorJID, to = To,
|
|||||||
xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang))
|
xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang))
|
||||||
end;
|
end;
|
||||||
deny ->
|
deny ->
|
||||||
Txt = <<"Denied by ACL">>,
|
Txt = <<"Access denied by service policy">>,
|
||||||
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ process_iq(#iq{from = From, to = To} = IQ, Source) ->
|
|||||||
process_iq(#iq{type = set, lang = Lang,
|
process_iq(#iq{type = set, lang = Lang,
|
||||||
sub_els = [#register{remove = true}]} = IQ,
|
sub_els = [#register{remove = true}]} = IQ,
|
||||||
_Source, _IsCaptchaEnabled, _AllowRemove = false) ->
|
_Source, _IsCaptchaEnabled, _AllowRemove = false) ->
|
||||||
Txt = <<"Denied by ACL">>,
|
Txt = <<"Access denied by service policy">>,
|
||||||
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang));
|
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang));
|
||||||
process_iq(#iq{type = set, lang = Lang, to = To, from = From,
|
process_iq(#iq{type = set, lang = Lang, to = To, from = From,
|
||||||
sub_els = [#register{remove = true,
|
sub_els = [#register{remove = true,
|
||||||
@ -270,7 +270,7 @@ try_register_or_set_password(User, Server, Password,
|
|||||||
xmpp:make_error(IQ, Error)
|
xmpp:make_error(IQ, Error)
|
||||||
end;
|
end;
|
||||||
deny ->
|
deny ->
|
||||||
Txt = <<"Denied by ACL">>,
|
Txt = <<"Access denied by service policy">>,
|
||||||
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
xmpp:make_error(IQ, xmpp:err_forbidden(Txt, Lang))
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
@ -322,8 +322,8 @@ try_register(User, Server, Password, SourceRaw, Lang) ->
|
|||||||
case {acl:match_rule(Server, Access, JID),
|
case {acl:match_rule(Server, Access, JID),
|
||||||
check_ip_access(SourceRaw, IPAccess)}
|
check_ip_access(SourceRaw, IPAccess)}
|
||||||
of
|
of
|
||||||
{deny, _} -> {error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
{deny, _} -> {error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||||
{_, deny} -> {error, xmpp:err_forbidden(<<"Denied by ACL">>, Lang)};
|
{_, deny} -> {error, xmpp:err_forbidden(<<"Access denied by service policy">>, Lang)};
|
||||||
{allow, allow} ->
|
{allow, allow} ->
|
||||||
Source = may_remove_resource(SourceRaw),
|
Source = may_remove_resource(SourceRaw),
|
||||||
case check_timeout(Source) of
|
case check_timeout(Source) of
|
||||||
|
@ -184,7 +184,7 @@ process_local_iq(#iq{type = set, from = From, lang = Lang,
|
|||||||
Access = gen_mod:get_module_opt(Server, ?MODULE, access, all),
|
Access = gen_mod:get_module_opt(Server, ?MODULE, access, all),
|
||||||
case acl:match_rule(Server, Access, From) of
|
case acl:match_rule(Server, Access, From) of
|
||||||
deny ->
|
deny ->
|
||||||
Txt = <<"Denied by ACL">>,
|
Txt = <<"Access denied by service policy">>,
|
||||||
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
|
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
|
||||||
allow ->
|
allow ->
|
||||||
process_iq_set(IQ)
|
process_iq_set(IQ)
|
||||||
|
@ -320,7 +320,7 @@ check_from_to(From, To) ->
|
|||||||
|
|
||||||
-spec mk_error(term()) -> stanza_error().
|
-spec mk_error(term()) -> stanza_error().
|
||||||
mk_error(forbidden) ->
|
mk_error(forbidden) ->
|
||||||
xmpp:err_forbidden(<<"Denied by ACL">>, ?MYLANG);
|
xmpp:err_forbidden(<<"Access denied by service policy">>, ?MYLANG);
|
||||||
mk_error(host_unknown) ->
|
mk_error(host_unknown) ->
|
||||||
xmpp:err_not_allowed(<<"Host unknown">>, ?MYLANG);
|
xmpp:err_not_allowed(<<"Host unknown">>, ?MYLANG);
|
||||||
mk_error({codec_error, Why}) ->
|
mk_error({codec_error, Why}) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user