summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMickael Remond <mremond@process-one.net>2016-04-06 14:48:05 +0200
committerMickael Remond <mremond@process-one.net>2016-04-06 18:13:08 +0200
commit47039aed1572b1c45b9207f0a1c97c6da972f898 (patch)
tree5cbbc45164ace18a9c33bd5942337cefc53d83af
parentAdd initial basic ACL test (diff)
Allow clearing all ACL and access rules
-rw-r--r--src/acl.erl11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/acl.erl b/src/acl.erl
index 0c1071d1..58b80b6a 100644
--- a/src/acl.erl
+++ b/src/acl.erl
@@ -34,7 +34,7 @@
match_rule/3, match_acl/3, transform_options/1,
opt_type/1]).
--export([add_access/3]).
+-export([add_access/3, clear/0]).
-include("ejabberd.hrl").
-include("logger.hrl").
@@ -45,6 +45,7 @@
rules = [] :: [access_rule()]}).
-type regexp() :: binary().
+-type iprange() :: {inet:ip_address(), integer()} | binary().
-type glob() :: binary().
-type access_name() :: atom().
-type access_rule() :: {atom(), any()}.
@@ -63,7 +64,7 @@
{user_glob, {glob(), host()} | glob()} |
{server_glob, glob()} |
{resource_glob, glob()} |
- {ip, {inet:ip_address(), integer()}} |
+ {ip, iprange()} |
{node_glob, {glob(), glob()}}.
-type acl() :: #acl{aclname :: aclname(),
@@ -206,6 +207,12 @@ load_from_config() ->
end, AccessRules)
end, Hosts).
+%% Delete all previous set ACLs and Access rules
+clear() ->
+ mnesia:clear_table(acl),
+ mnesia:clear_table(access),
+ ok.
+
b(S) ->
iolist_to_binary(S).