aboutsummaryrefslogtreecommitdiff
path: root/src/acl.erl
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2016-06-15 19:20:27 +0200
committerPaweł Chmielowski <pchmielowski@process-one.net>2016-06-15 19:23:55 +0200
commit7b308e0d41909e515ec42acfbd31167e7e4f617d (patch)
tree866008ae95231e08f774870de9502df4ee8eeba2 /src/acl.erl
parentCheck password with jid:resourceprep when registering account (#996) (diff)
Add shorter version of some common access rules definitions
This add conversion of - allow to - allow: all and - allow: acl_name to - allow: - acl: acl_name (this works also for deny, and number in shapers)
Diffstat (limited to 'src/acl.erl')
-rw-r--r--src/acl.erl13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/acl.erl b/src/acl.erl
index 57675112d..2864e4740 100644
--- a/src/acl.erl
+++ b/src/acl.erl
@@ -518,11 +518,16 @@ parse_ip_netmask(S) ->
transform_access_rules_config(Config) ->
lists:map(fun transform_access_rules_config2/1, lists:flatten(Config)).
+transform_access_rules_config2(Type) when is_integer(Type); Type == allow; Type == deny ->
+ {Type, [all]};
+transform_access_rules_config2({Type, ACL}) when is_atom(ACL) ->
+ {Type, [{acl, ACL}]};
transform_access_rules_config2({Res, Rules}) when is_list(Rules) ->
- {Res, lists:map(fun({Type, Args}) when is_list(Args) ->
- normalize_spec({Type, hd(lists:flatten(Args))});
- (V) -> normalize_spec(V)
- end, lists:flatten(Rules))};
+ T = lists:map(fun({Type, Args}) when is_list(Args) ->
+ normalize_spec({Type, hd(lists:flatten(Args))});
+ (V) -> normalize_spec(V)
+ end, lists:flatten(Rules)),
+ {Res, T};
transform_access_rules_config2({Res, Rule}) ->
{Res, [Rule]}.