25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Access list editing broken in web_admin (#252)

This commit is contained in:
Badlop 2015-03-05 11:34:25 +01:00
parent e575f401cd
commit e0228e9b7a

View File

@ -717,10 +717,9 @@ process_admin(Host,
auth = {_, _Auth, AJID}, q = Query, lang = Lang}) -> auth = {_, _Auth, AJID}, q = Query, lang = Lang}) ->
SetAccess = fun (Rs) -> SetAccess = fun (Rs) ->
mnesia:transaction(fun () -> mnesia:transaction(fun () ->
Os = mnesia:select(local_config, Os = mnesia:select(access,
[{{local_config, [{{access,
{access, {'$1',
'$1',
Host}, Host},
'$2'}, '$2'},
[], [],
@ -732,9 +731,8 @@ process_admin(Host,
lists:foreach(fun ({access, lists:foreach(fun ({access,
Name, Name,
Rules}) -> Rules}) ->
mnesia:write({local_config, mnesia:write({access,
{access, {Name,
Name,
Host}, Host},
Rules}) Rules})
end, end,
@ -757,8 +755,8 @@ process_admin(Host,
end; end;
_ -> nothing _ -> nothing
end, end,
Access = ets:select(local_config, Access = ets:select(access,
[{{local_config, {access, '$1', Host}, '$2'}, [], [{{access, {'$1', Host}, '$2'}, [],
[{{access, '$1', '$2'}}]}]), [{{access, '$1', '$2'}}]}]),
{NumLines, AccessP} = term_to_paragraph(lists:keysort(2,Access), 80), {NumLines, AccessP} = term_to_paragraph(lists:keysort(2,Access), 80),
make_xhtml((?H1GL((?T(<<"Access Rules">>)), make_xhtml((?H1GL((?T(<<"Access Rules">>)),
@ -791,8 +789,8 @@ process_admin(Host,
end; end;
_ -> nothing _ -> nothing
end, end,
AccessRules = ets:select(local_config, AccessRules = ets:select(access,
[{{local_config, {access, '$1', Host}, '$2'}, [], [{{access, {'$1', Host}, '$2'}, [],
[{{access, '$1', '$2'}}]}]), [{{access, '$1', '$2'}}]}]),
make_xhtml((?H1GL((?T(<<"Access Rules">>)), make_xhtml((?H1GL((?T(<<"Access Rules">>)),
<<"AccessRights">>, <<"Access Rights">>)) <<"AccessRights">>, <<"Access Rights">>))
@ -1174,8 +1172,8 @@ access_rules_to_xhtml(AccessRules, Lang) ->
<<"Add New">>)])])]))]). <<"Add New">>)])])]))]).
access_parse_query(Host, Query) -> access_parse_query(Host, Query) ->
AccessRules = ets:select(local_config, AccessRules = ets:select(access,
[{{local_config, {access, '$1', Host}, '$2'}, [], [{{access, {'$1', Host}, '$2'}, [],
[{{access, '$1', '$2'}}]}]), [{{access, '$1', '$2'}}]}]),
case lists:keysearch(<<"addnew">>, 1, Query) of case lists:keysearch(<<"addnew">>, 1, Query) of
{value, _} -> {value, _} ->
@ -1203,9 +1201,8 @@ access_parse_delete(AccessRules, Host, Query) ->
case lists:member({<<"selected">>, ID}, Query) of case lists:member({<<"selected">>, ID}, Query) of
true -> true ->
mnesia:transaction(fun () -> mnesia:transaction(fun () ->
mnesia:delete({local_config, mnesia:delete({access,
{access, {Name,
Name,
Host}}) Host}})
end); end);
_ -> ok _ -> ok