summaryrefslogtreecommitdiff
path: root/src/acl.erl
diff options
context:
space:
mode:
authorMickael Remond <mremond@process-one.net>2016-07-23 16:21:00 +0200
committerMickael Remond <mremond@process-one.net>2016-07-23 18:21:45 +0200
commit1485b5621151c37948ebd6c68232c3ffd23984f1 (patch)
tree2dd304146d95dc7889f04a51a335e004a9aa9908 /src/acl.erl
parentClean-up of error codes and format json structure (diff)
Move any access rules check to ACL module
Diffstat (limited to 'src/acl.erl')
-rw-r--r--src/acl.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/acl.erl b/src/acl.erl
index 31a7547d..834b85d9 100644
--- a/src/acl.erl
+++ b/src/acl.erl
@@ -31,7 +31,7 @@
-export([add_access/3, clear/0]).
-export([start/0, add/3, add_list/3, add_local/3, add_list_local/3,
- load_from_config/0, match_rule/3,
+ load_from_config/0, match_rule/3, any_rules_allowed/3,
transform_options/1, opt_type/1, acl_rule_matches/3,
acl_rule_verify/1, access_matches/3,
transform_access_rules_config/1,
@@ -274,6 +274,15 @@ normalize_spec(Spec) ->
end
end.
+-spec any_rules_allowed(global | binary(), access_name(),
+ jid() | ljid() | inet:ip_address()) -> boolean().
+
+any_rules_allowed(Host, Access, Entity) ->
+ lists:any(fun (Rule) ->
+ allow == acl:match_rule(Host, Rule, Entity)
+ end,
+ Access).
+
-spec match_rule(global | binary(), access_name(),
jid() | ljid() | inet:ip_address()) -> any().