25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Allow clearing all ACL and access rules

This commit is contained in:
Mickael Remond 2016-04-06 14:48:05 +02:00
parent d45ad3e3a5
commit 47039aed15

View File

@ -34,7 +34,7 @@
match_rule/3, match_acl/3, transform_options/1, match_rule/3, match_acl/3, transform_options/1,
opt_type/1]). opt_type/1]).
-export([add_access/3]). -export([add_access/3, clear/0]).
-include("ejabberd.hrl"). -include("ejabberd.hrl").
-include("logger.hrl"). -include("logger.hrl").
@ -45,6 +45,7 @@
rules = [] :: [access_rule()]}). rules = [] :: [access_rule()]}).
-type regexp() :: binary(). -type regexp() :: binary().
-type iprange() :: {inet:ip_address(), integer()} | binary().
-type glob() :: binary(). -type glob() :: binary().
-type access_name() :: atom(). -type access_name() :: atom().
-type access_rule() :: {atom(), any()}. -type access_rule() :: {atom(), any()}.
@ -63,7 +64,7 @@
{user_glob, {glob(), host()} | glob()} | {user_glob, {glob(), host()} | glob()} |
{server_glob, glob()} | {server_glob, glob()} |
{resource_glob, glob()} | {resource_glob, glob()} |
{ip, {inet:ip_address(), integer()}} | {ip, iprange()} |
{node_glob, {glob(), glob()}}. {node_glob, {glob(), glob()}}.
-type acl() :: #acl{aclname :: aclname(), -type acl() :: #acl{aclname :: aclname(),
@ -206,6 +207,12 @@ load_from_config() ->
end, AccessRules) end, AccessRules)
end, Hosts). end, Hosts).
%% Delete all previous set ACLs and Access rules
clear() ->
mnesia:clear_table(acl),
mnesia:clear_table(access),
ok.
b(S) -> b(S) ->
iolist_to_binary(S). iolist_to_binary(S).