summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shchepin <alexey@process-one.net>2004-03-20 20:55:58 +0000
committerAlexey Shchepin <alexey@process-one.net>2004-03-20 20:55:58 +0000
commit2f47b7edd95d7a3135a59f5946a4b070eabd7b80 (patch)
tree59eba00c6e6271224ff7070523ccee62c0bba494
parent* src/mod_roster.erl: Bugfix (diff)
* doc/guide.tex: Updated
* src/web/ejabberd_web.erl: Updated * src/web/ejabberd_http.erl: Bugfix SVN Revision: 220
Diffstat (limited to '')
-rw-r--r--ChangeLog16
-rw-r--r--doc/guide.html9
-rw-r--r--doc/guide.tex7
-rw-r--r--src/web/ejabberd_http.erl3
-rw-r--r--src/web/ejabberd_web.erl141
5 files changed, 160 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 97fb1c8e..d5332946 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2004-03-20 Alexey Shchepin <alexey@sevcom.net>
+
+ * doc/guide.tex: Updated
+
+ * src/web/ejabberd_web.erl: Updated
+
+ * src/web/ejabberd_http.erl: Bugfix
+
2004-03-16 Alexey Shchepin <alexey@sevcom.net>
* src/mod_roster.erl: Bugfix
@@ -139,7 +147,7 @@
* src/mod_irc/mod_irc.erl: Likewise
* src/mod_configure.erl: "jabber:iq:data" replaced with
- "ejabber:config" namespace (thanks to Sergei Golovan)
+ "ejabberd:config" namespace (thanks to Sergei Golovan)
* src/mod_disco.erl: Likewise
2004-02-12 Alexey Shchepin <alexey@sevcom.net>
@@ -150,15 +158,15 @@
* src/msgs/ru.msg: Updated (thanks to Sergei Golovan)
- * src/mod_irc/mod_irc.erl: Now uses "ejabber:config" namespace
+ * src/mod_irc/mod_irc.erl: Now uses "ejabberd:config" namespace
(thanks to Sergei Golovan)
* src/mod_disco.erl: Fixed disco category and type (thanks to
Sergei Golovan)
* src/mod_pubsub/mod_pubsub.erl: Likewise
- * src/jlib.hrl: Added "ejabber:config" namespace (thanks to Sergei
- Golovan)
+ * src/jlib.hrl: Added "ejabberd:config" namespace (thanks to
+ Sergei Golovan)
2004-01-27 Alexey Shchepin <alexey@sevcom.net>
diff --git a/doc/guide.html b/doc/guide.html
index 861864c4..e35e5387 100644
--- a/doc/guide.html
+++ b/doc/guide.html
@@ -129,7 +129,11 @@ Works on most of popular platforms: *nix (tested on Linux, FreeBSD and
<A HREF="http://www.jabber.org/jeps/jep-0060.html">Publish-Subscribe</A>
service
<LI>Built-in Jabber Users Directory service based on users vCards
+<LI>Built-in
+ <A HREF="http://www.jabber.org/jeps/jep-0025.html">HTTP Polling</A>
+ service
<LI>SSL support
+<LI>Support for LDAP authentification
<LI>Ability to interface with external components (JIT, MSN-t, Yahoo-t, etc)
<LI>Migration from jabberd14 is possible
<LI>Mostly XMPP-compliant
@@ -139,12 +143,11 @@ Works on most of popular platforms: *nix (tested on Linux, FreeBSD and
<LI>Support for
<A HREF="http://www.jabber.org/jeps/jep-0039.html">JEP-0039</A>
(Statistics Gathering).
-<LI>Support for <TT>xml:lang</TT> attribute in many XML elements
+<LI>Support for <TT>xml:lang</TT>
</UL>
The misfeatures of <TT>ejabberd</TT> is:
<UL><LI>
-No support for external authentification
-<LI>No support for virtual domains
+No support for virtual domains
<LI>No support for STARTTLS
</UL>
<!--TOC section Installation-->
diff --git a/doc/guide.tex b/doc/guide.tex
index d20912c8..2d552d6d 100644
--- a/doc/guide.tex
+++ b/doc/guide.tex
@@ -78,7 +78,11 @@ The main features of \ejabberd{} is:
\footahref{http://www.jabber.org/jeps/jep-0060.html}{Publish-Subscribe}
service
\item Built-in Jabber Users Directory service based on users vCards
+\item Built-in
+ \footahref{http://www.jabber.org/jeps/jep-0025.html}{HTTP Polling}
+ service
\item SSL support
+\item Support for LDAP authentification
\item Ability to interface with external components (JIT, MSN-t, Yahoo-t, etc)
\item Migration from jabberd14 is possible
\item Mostly XMPP-compliant
@@ -88,12 +92,11 @@ The main features of \ejabberd{} is:
\item Support for
\footahref{http://www.jabber.org/jeps/jep-0039.html}{JEP-0039}
(Statistics Gathering).
-\item Support for \ns{xml:lang} attribute in many XML elements
+\item Support for \ns{xml:lang}
\end{itemize}
The misfeatures of \ejabberd{} is:
\begin{itemize}
-\item No support for external authentification
\item No support for virtual domains
\item No support for STARTTLS
\end{itemize}
diff --git a/src/web/ejabberd_http.erl b/src/web/ejabberd_http.erl
index cf4427b2..c5988d34 100644
--- a/src/web/ejabberd_http.erl
+++ b/src/web/ejabberd_http.erl
@@ -122,7 +122,8 @@ process_request(#state{request_method = 'GET',
case ejabberd_web:process_get(Request) of
El when element(1, El) == xmlelement ->
make_xhtml_output(200, [], El);
- {Status, Headers, El} ->
+ {Status, Headers, El} when
+ element(1, El) == xmlelement ->
make_xhtml_output(Status, Headers, El);
Text when is_list(Text) ->
make_text_output(200, [], Text);
diff --git a/src/web/ejabberd_web.erl b/src/web/ejabberd_web.erl
index 5377d256..d532f78f 100644
--- a/src/web/ejabberd_web.erl
+++ b/src/web/ejabberd_web.erl
@@ -84,7 +84,8 @@ process_admin(#request{user = User,
?XE("ul",
[?LI([?AC("acls/", "Access Control Lists"), ?C(" "),
?AC("acls-raw/", "(raw)")]),
- ?LI([?AC("access/", "Access Rules")]),
+ ?LI([?AC("access/", "Access Rules"), ?C(" "),
+ ?AC("access-raw/", "(raw)")]),
?LI([?AC("users/", "Users")]),
?LI([?AC("nodes/", "Nodes")]),
?LI([?AC("stats/", "Statistics")])
@@ -178,6 +179,100 @@ process_admin(#request{method = Method,
]);
process_admin(#request{user = User,
+ path = ["access-raw"],
+ q = Query,
+ lang = Lang} = Request) ->
+ SetAccess =
+ fun(Rs) ->
+ mnesia:transaction(
+ fun() ->
+ Os = mnesia:select(config,
+ [{{config, {access, '$1'}, '$2'},
+ [],
+ ['$_']}]),
+ lists:foreach(fun(O) ->
+ mnesia:delete_object(O)
+ end, Os),
+ lists:foreach(
+ fun({access, Name, Rules}) ->
+ mnesia:write({config,
+ {access, Name},
+ Rules})
+ end, Rs)
+ end)
+ end,
+ Res = case lists:keysearch("access", 1, Query) of
+ {value, {_, String}} ->
+ case erl_scan:string(String) of
+ {ok, Tokens, _} ->
+ case erl_parse:parse_term(Tokens) of
+ {ok, Rs} ->
+ case SetAccess(Rs) of
+ {atomic, _} ->
+ ok;
+ _ ->
+ error
+ end;
+ _ ->
+ error
+ end;
+ _ ->
+ error
+ end;
+ _ ->
+ nothing
+ end,
+ Access =
+ lists:flatten(
+ io_lib:format(
+ "~p.", [ets:select(config,
+ [{{config, {access, '$1'}, '$2'},
+ [],
+ [{{access, '$1', '$2'}}]}])])),
+ make_xhtml([?XC("h1", "ejabberd access rules configuration")] ++
+ case Res of
+ ok -> [?C("submited"), ?P];
+ error -> [?C("bad format"), ?P];
+ nothing -> []
+ end ++
+ [?XAE("form", [{"method", "post"}],
+ [?XAC("textarea", [{"name", "access"},
+ {"rows", "16"},
+ {"cols", "80"}],
+ Access),
+ ?BR,
+ ?XA("input", [{"type", "submit"}])
+ ])
+ ]);
+
+process_admin(#request{method = Method,
+ user = User,
+ path = ["access"],
+ q = Query,
+ lang = Lang} = Request) ->
+ ?INFO_MSG("query: ~p", [Query]),
+ Res = nothing,
+ AccessRules =
+ ets:select(config,
+ [{{config, {access, '$1'}, '$2'},
+ [],
+ [{{access, '$1', '$2'}}]}]),
+ make_xhtml([?XC("h1", "ejabberd access rules configuration")] ++
+ case Res of
+ ok -> [?C("submited"), ?P];
+ error -> [?C("bad format"), ?P];
+ nothing -> []
+ end ++
+ [?XAE("form", [{"method", "post"}],
+ [access_rules_to_xhtml(AccessRules),
+ ?BR,
+ ?XA("input", [{"type", "submit"},
+ {"name", "delete"},
+ {"value", "Delete Selected"}])
+ ])
+ ]);
+
+process_admin(#request{user = User,
path = ["users"],
q = Query,
lang = Lang} = Request) ->
@@ -209,7 +304,7 @@ acls_to_xhtml(ACLs) ->
lists:map(
fun({acl, Name, Spec} = ACL) ->
SName = atom_to_list(Name),
- ID = acl_to_id(ACL),
+ ID = term_to_id(ACL),
?XE("tr",
[?XE("td",
[?XA("input", [{"type", "checkbox"},
@@ -268,8 +363,8 @@ acl_spec_select(ID, Opt) ->
term_to_string(T) ->
lists:flatten(io_lib:format("~1000000p", [T])).
-acl_to_id(ACL) ->
- jlib:encode_base64(binary_to_list(term_to_binary(ACL))).
+term_to_id(T) ->
+ jlib:encode_base64(binary_to_list(term_to_binary(T))).
acl_parse_query(Query) ->
@@ -289,7 +384,7 @@ acl_parse_submit(ACLs, Query) ->
lists:map(
fun({acl, Name, Spec} = ACL) ->
SName = atom_to_list(Name),
- ID = acl_to_id(ACL),
+ ID = term_to_id(ACL),
case {lists:keysearch("type" ++ ID, 1, Query),
lists:keysearch("value" ++ ID, 1, Query)} of
{{value, {_, T}}, {value, {_, V}}} ->
@@ -336,12 +431,46 @@ acl_parse_delete(ACLs, Query) ->
NewACLs =
lists:filter(
fun({acl, Name, Spec} = ACL) ->
- ID = acl_to_id(ACL),
+ ID = term_to_id(ACL),
not lists:member({"selected", ID}, Query)
end, ACLs),
NewACLs.
+access_rules_to_xhtml(AccessRules) ->
+ ?XAE("table", [],
+ [?XE("tbody",
+ lists:map(
+ fun({access, Name, Rules} = Access) ->
+ SName = atom_to_list(Name),
+ ID = term_to_id(Access),
+ ?XE("tr",
+ [?XE("td",
+ [?XA("input", [{"type", "checkbox"},
+ {"name", "selected"},
+ {"value", ID}])]),
+ ?XE("td", [?AC(SName ++ "/", SName)]),
+ ?XC("td", term_to_string(Rules))
+ ]
+ )
+ end, AccessRules) ++
+ [?XE("tr",
+ [?X("td"),
+ ?XE("td",
+ [?XA("input", [{"type", "text"},
+ {"name", "namenew"},
+ {"value", ""}])]
+ ),
+ ?XE("td",
+ [?XA("input", [{"type", "submit"},
+ {"name", "addnew"},
+ {"value", "Add New"}])])
+ ]
+ )]
+ )]).
+
+
+
list_users() ->
Users = ejabberd_auth:dirty_get_registered_users(),