LQuery = parse_urlencoded(Query),
?INFO_MSG("path: ~p, query: ~p~n", [NPath, LQuery]),
LPath = string:tokens(NPath, "/"),
- case ejabberd_web:process_get(User, LPath, LQuery) of
+ case ejabberd_web:process_get(User, LPath, LQuery, "") of
El when element(1, El) == xmlelement ->
make_xhtml_output(200, [], El);
{Status, Headers, El} ->
LPath = string:tokens(NPath, "/"),
LQuery = parse_urlencoded(Data),
?INFO_MSG("client query: ~p~n", [LQuery]),
- case ejabberd_web:process_get(User, LPath, LQuery) of
+ case ejabberd_web:process_get(User, LPath, LQuery, "") of
El when element(1, El) == xmlelement ->
make_xhtml_output(200, [], El);
{Status, Headers, El} ->
%% External exports
-export([make_xhtml/1,
- process_get/3]).
+ process_get/4]).
-include("ejabberd.hrl").
-include("jlib.hrl").
-define(P, ?X("p")).
-define(BR, ?X("br")).
-process_get(User, [], Query) ->
+
+process_get(User, ["config" | RPath], Query, Lang) ->
+ case acl:match_rule(configure, jlib:make_jid(User, ?MYNAME, "")) of
+ deny ->
+ {401, [], make_xhtml([?XC("h1", "Not Allowed")])};
+ allow ->
+ process_config(User, RPath, Query, Lang)
+ end;
+
+process_get(User, Path, Query, Lang) ->
+ {404, [], make_xhtml([?XC("h1", "Not found")])}.
+
+
+
+process_config(User, [], Query, Lang) ->
make_xhtml([?XC("h1", "ejabberd configuration"),
?XE("ul",
[?LI([?AC("acls/", "Access Control Lists")]),
])
]);
-process_get(User, ["acls"], Query) ->
+process_config(User, ["acls"], Query, Lang) ->
case acl:match_rule(configure, jlib:make_jid(User, ?MYNAME, "")) of
deny ->
{401, [], make_xhtml([?XC("h1", "Not Allowed")])};
])
end;
-process_get(User, Path, Query) ->
+process_config(User, Path, Query, Lang) ->
{404, [], make_xhtml([?XC("h1", "Not found")])}.