mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-03 18:02:28 +01:00
* src/mod_muc/mod_muc_room.erl: It is now possible to limit who is allowed to create persistent MUC rooms (Thanks to Badlop) (EJAB-257)
* src/mod_muc/mod_muc.erl: Likewise * doc/guide.tex: Likewise * src/ejabberd.cfg.example: Likewise SVN Revision: 786
This commit is contained in:
parent
d2dd6eef09
commit
81117800e8
@ -1,3 +1,11 @@
|
||||
2007-06-20 Mickael Remond <mickael.remond@process-one.net>
|
||||
|
||||
* src/mod_muc/mod_muc_room.erl: It is now possible to limit who is
|
||||
allowed to create persistent MUC rooms (Thanks to Badlop) (EJAB-257)
|
||||
* src/mod_muc/mod_muc.erl: Likewise
|
||||
* doc/guide.tex: Likewise
|
||||
* src/ejabberd.cfg.example: Likewise
|
||||
|
||||
2007-06-18 Mickael Remond <mickael.remond@process-one.net>
|
||||
|
||||
* src/odbc/odbc_queries.erl: Added missing users_number/1 for MSSQL
|
||||
|
@ -1918,6 +1918,9 @@ Options:
|
||||
\titem{access\_create} \ind{options!access\_create}To configure who is
|
||||
allowed to create new rooms at the Multi-User Chat service, this option
|
||||
can be used (by default, everybody is allowed to create rooms).
|
||||
\titem{access\_persistent} \ind{options!access\_persistent}To configure who is
|
||||
allowed to modify the 'persistent' chatroom option
|
||||
(by default, everybody is allowed to modify that option).
|
||||
\titem{access\_admin} \ind{options!access\_admin}This option specifies
|
||||
who is allowed to administrate the Multi-User Chat service (the default
|
||||
value is \term{none}, which means that only the room creator can
|
||||
|
@ -172,9 +172,11 @@
|
||||
% host: "conference." ++ ?MYNAME
|
||||
% access: all
|
||||
% access_create: all
|
||||
% access_persistent: all
|
||||
% access_admin: none (only room creator has owner privileges)
|
||||
{mod_muc, [{access, muc},
|
||||
{access_create, muc},
|
||||
{access_persistent, muc},
|
||||
{access_admin, muc_admin}]},
|
||||
% {mod_muc_log, []},
|
||||
% {mod_shared_roster, []},
|
||||
|
@ -154,13 +154,14 @@ init([Host, Opts]) ->
|
||||
Access = gen_mod:get_opt(access, Opts, all),
|
||||
AccessCreate = gen_mod:get_opt(access_create, Opts, all),
|
||||
AccessAdmin = gen_mod:get_opt(access_admin, Opts, none),
|
||||
AccessPersistent = gen_mod:get_opt(access_persistent, Opts, all),
|
||||
HistorySize = gen_mod:get_opt(history_size, Opts, 20),
|
||||
ejabberd_router:register_route(MyHost),
|
||||
load_permanent_rooms(MyHost, Host, {Access, AccessCreate, AccessAdmin},
|
||||
load_permanent_rooms(MyHost, Host, {Access, AccessCreate, AccessAdmin, AccessPersistent},
|
||||
HistorySize),
|
||||
{ok, #state{host = MyHost,
|
||||
server_host = Host,
|
||||
access = {Access, AccessCreate, AccessAdmin},
|
||||
access = {Access, AccessCreate, AccessAdmin, AccessPersistent},
|
||||
history_size = HistorySize}}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
@ -254,7 +255,7 @@ stop_supervisor(Host) ->
|
||||
supervisor:delete_child(ejabberd_sup, Proc).
|
||||
|
||||
do_route(Host, ServerHost, Access, HistorySize, From, To, Packet) ->
|
||||
{AccessRoute, _AccessCreate, _AccessAdmin} = Access,
|
||||
{AccessRoute, _AccessCreate, _AccessAdmin, AccessPersistent} = Access,
|
||||
case acl:match_rule(ServerHost, AccessRoute, From) of
|
||||
allow ->
|
||||
do_route1(Host, ServerHost, Access, HistorySize, From, To, Packet);
|
||||
@ -269,7 +270,7 @@ do_route(Host, ServerHost, Access, HistorySize, From, To, Packet) ->
|
||||
|
||||
|
||||
do_route1(Host, ServerHost, Access, HistorySize, From, To, Packet) ->
|
||||
{_AccessRoute, AccessCreate, AccessAdmin} = Access,
|
||||
{_AccessRoute, AccessCreate, AccessAdmin, AccessPersistent} = Access,
|
||||
{Room, _, Nick} = jlib:jid_tolower(To),
|
||||
{xmlelement, Name, Attrs, _Els} = Packet,
|
||||
case Room of
|
||||
|
@ -773,7 +773,7 @@ set_affiliation_and_reason(JID, Affiliation, Reason, StateData) ->
|
||||
StateData#state{affiliations = Affiliations}.
|
||||
|
||||
get_affiliation(JID, StateData) ->
|
||||
{_AccessRoute, _AccessCreate, AccessAdmin} = StateData#state.access,
|
||||
{_AccessRoute, _AccessCreate, AccessAdmin, _AccessPersistent} = StateData#state.access,
|
||||
Res =
|
||||
case acl:match_rule(StateData#state.server_host, AccessAdmin, JID) of
|
||||
allow ->
|
||||
@ -2041,9 +2041,10 @@ process_iq_owner(From, set, Lang, SubEl, StateData) ->
|
||||
{?NS_XDATA, "cancel"} ->
|
||||
{result, [], StateData};
|
||||
{?NS_XDATA, "submit"} ->
|
||||
case check_allowed_log_change(XEl, StateData, From) of
|
||||
allow -> set_config(XEl, StateData);
|
||||
deny -> {error, ?ERR_BAD_REQUEST}
|
||||
case {check_allowed_log_change(XEl, StateData, From),
|
||||
check_allowed_persistent_change(XEl, StateData, From)} of
|
||||
{allow, allow} -> set_config(XEl, StateData);
|
||||
_ -> {error, ?ERR_BAD_REQUEST}
|
||||
end;
|
||||
_ ->
|
||||
{error, ?ERR_BAD_REQUEST}
|
||||
@ -2104,6 +2105,15 @@ check_allowed_log_change(XEl, StateData, From) ->
|
||||
StateData#state.server_host, From)
|
||||
end.
|
||||
|
||||
check_allowed_persistent_change(XEl, StateData, From) ->
|
||||
case lists:keymember("muc#roomconfig_persistentroom", 1,
|
||||
jlib:parse_xdata_submit(XEl)) of
|
||||
false ->
|
||||
allow;
|
||||
true ->
|
||||
{_AccessRoute, _AccessCreate, _AccessAdmin, AccessPersistent} = StateData#state.access,
|
||||
acl:match_rule(StateData#state.server_host, AccessPersistent, From)
|
||||
end.
|
||||
|
||||
-define(XFIELD(Type, Label, Var, Val),
|
||||
{xmlelement, "field", [{"type", Type},
|
||||
@ -2126,6 +2136,7 @@ check_allowed_log_change(XEl, StateData, From) ->
|
||||
|
||||
|
||||
get_config(Lang, StateData, From) ->
|
||||
{_AccessRoute, _AccessCreate, _AccessAdmin, AccessPersistent} = StateData#state.access,
|
||||
Config = StateData#state.config,
|
||||
Res =
|
||||
[{xmlelement, "title", [],
|
||||
@ -2137,10 +2148,16 @@ get_config(Lang, StateData, From) ->
|
||||
[{xmlcdata, "http://jabber.org/protocol/muc#roomconfig"}]}]},
|
||||
?STRINGXFIELD("Room title",
|
||||
"muc#roomconfig_roomname",
|
||||
Config#config.title),
|
||||
?BOOLXFIELD("Make room persistent",
|
||||
Config#config.title)
|
||||
] ++
|
||||
case acl:match_rule(StateData#state.server_host, AccessPersistent, From) of
|
||||
allow ->
|
||||
[?BOOLXFIELD(
|
||||
"Make room persistent",
|
||||
"muc#roomconfig_persistentroom",
|
||||
Config#config.persistent),
|
||||
Config#config.persistent)];
|
||||
_ -> []
|
||||
end ++ [
|
||||
?BOOLXFIELD("Make room public searchable",
|
||||
"muc#roomconfig_publicroom",
|
||||
Config#config.public),
|
||||
|
Loading…
Reference in New Issue
Block a user