mirror of
https://github.com/processone/ejabberd.git
synced 2024-09-21 14:06:57 +02:00
* src/web/: Minor update
SVN Revision: 207
This commit is contained in:
parent
ec182cbd60
commit
0f95685c05
@ -1,3 +1,7 @@
|
|||||||
|
2004-03-03 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
|
* src/web/: Minor update
|
||||||
|
|
||||||
2004-03-02 Alexey Shchepin <alexey@sevcom.net>
|
2004-03-02 Alexey Shchepin <alexey@sevcom.net>
|
||||||
|
|
||||||
* src/web/: Small HTTP server and admin web-interface to ejabberd
|
* src/web/: Small HTTP server and admin web-interface to ejabberd
|
||||||
|
@ -102,7 +102,7 @@ process_request(#state{request_method = 'GET',
|
|||||||
LQuery = parse_urlencoded(Query),
|
LQuery = parse_urlencoded(Query),
|
||||||
?INFO_MSG("path: ~p, query: ~p~n", [NPath, LQuery]),
|
?INFO_MSG("path: ~p, query: ~p~n", [NPath, LQuery]),
|
||||||
LPath = string:tokens(NPath, "/"),
|
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 ->
|
El when element(1, El) == xmlelement ->
|
||||||
make_xhtml_output(200, [], El);
|
make_xhtml_output(200, [], El);
|
||||||
{Status, Headers, El} ->
|
{Status, Headers, El} ->
|
||||||
@ -141,7 +141,7 @@ process_request(#state{request_method = 'POST',
|
|||||||
LPath = string:tokens(NPath, "/"),
|
LPath = string:tokens(NPath, "/"),
|
||||||
LQuery = parse_urlencoded(Data),
|
LQuery = parse_urlencoded(Data),
|
||||||
?INFO_MSG("client query: ~p~n", [LQuery]),
|
?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 ->
|
El when element(1, El) == xmlelement ->
|
||||||
make_xhtml_output(200, [], El);
|
make_xhtml_output(200, [], El);
|
||||||
{Status, Headers, El} ->
|
{Status, Headers, El} ->
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
%% External exports
|
%% External exports
|
||||||
-export([make_xhtml/1,
|
-export([make_xhtml/1,
|
||||||
process_get/3]).
|
process_get/4]).
|
||||||
|
|
||||||
-include("ejabberd.hrl").
|
-include("ejabberd.hrl").
|
||||||
-include("jlib.hrl").
|
-include("jlib.hrl").
|
||||||
@ -43,7 +43,21 @@ make_xhtml(Els) ->
|
|||||||
-define(P, ?X("p")).
|
-define(P, ?X("p")).
|
||||||
-define(BR, ?X("br")).
|
-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"),
|
make_xhtml([?XC("h1", "ejabberd configuration"),
|
||||||
?XE("ul",
|
?XE("ul",
|
||||||
[?LI([?AC("acls/", "Access Control Lists")]),
|
[?LI([?AC("acls/", "Access Control Lists")]),
|
||||||
@ -53,7 +67,7 @@ process_get(User, [], Query) ->
|
|||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
process_get(User, ["acls"], Query) ->
|
process_config(User, ["acls"], Query, Lang) ->
|
||||||
case acl:match_rule(configure, jlib:make_jid(User, ?MYNAME, "")) of
|
case acl:match_rule(configure, jlib:make_jid(User, ?MYNAME, "")) of
|
||||||
deny ->
|
deny ->
|
||||||
{401, [], make_xhtml([?XC("h1", "Not Allowed")])};
|
{401, [], make_xhtml([?XC("h1", "Not Allowed")])};
|
||||||
@ -97,7 +111,7 @@ process_get(User, ["acls"], Query) ->
|
|||||||
])
|
])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
process_get(User, Path, Query) ->
|
process_config(User, Path, Query, Lang) ->
|
||||||
{404, [], make_xhtml([?XC("h1", "Not found")])}.
|
{404, [], make_xhtml([?XC("h1", "Not found")])}.
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user