diff options
author | Mickael Remond <mremond@process-one.net> | 2016-04-07 12:35:29 +0200 |
---|---|---|
committer | Mickael Remond <mremond@process-one.net> | 2016-04-07 12:35:29 +0200 |
commit | 60c0c8e968c287e548bf877013bec6a5fffab25e (patch) | |
tree | e40144ef0504f7fe7427eec7a0a0fb06106f650a /test | |
parent | IP based ACL / Access rules and sequential evaluation of rules (diff) |
Add test when mixing ip / user rules
Diffstat (limited to 'test')
-rw-r--r-- | test/acl_test.exs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/acl_test.exs b/test/acl_test.exs index 00c04ed6..cc968212 100644 --- a/test/acl_test.exs +++ b/test/acl_test.exs @@ -70,6 +70,17 @@ defmodule ACLTest do assert :acl.match_rule(:global, :user_rule_1, :jid.from_string("test1@domain2")) == :deny end - # At the moment IP and user rules to no go well together: TODO + # At the moment IP and user rules to no go well together: + test "mixing IP and user access rules" do + :acl.add(:global, :user_acl_1, {:user, "test1"}) + :acl.add(:global, :ip_acl_1, {:ip, "127.0.0.0/24"}) + :acl.add_access(:global, :mixed_rule_1, [{:user_acl_1, :allow}, {:ip_acl_1, :allow}]) + assert :acl.match_rule(:global, :mixed_rule_1, :jid.from_string("test1@domain1")) == :allow + assert :acl.match_rule(:global, :mixed_rule_1, {127,0,0,1}) == :allow + + :acl.add_access(:global, :mixed_rule_2, [{:user_acl_1, :deny}, {:ip_acl_1, :allow}]) + assert :acl.match_rule(:global, :mixed_rule_2, :jid.from_string("test1@domain1")) == :deny + assert :acl.match_rule(:global, :mixed_rule_2, {127,0,0,1}) == :allow + end end |