(t *testing.T)
| 668 | } |
| 669 | |
| 670 | func TestDomainMatchModel(t *testing.T) { |
| 671 | e, _ := NewEnforcer("examples/rbac_with_domain_pattern_model.conf", "examples/rbac_with_domain_pattern_policy.csv") |
| 672 | e.AddNamedDomainMatchingFunc("g", "keyMatch2", util.KeyMatch2) |
| 673 | |
| 674 | testDomainEnforce(t, e, "alice", "domain1", "data1", "read", true) |
| 675 | testDomainEnforce(t, e, "alice", "domain1", "data1", "write", true) |
| 676 | testDomainEnforce(t, e, "alice", "domain1", "data2", "read", false) |
| 677 | testDomainEnforce(t, e, "alice", "domain1", "data2", "write", false) |
| 678 | testDomainEnforce(t, e, "alice", "domain2", "data2", "read", true) |
| 679 | testDomainEnforce(t, e, "alice", "domain2", "data2", "write", true) |
| 680 | testDomainEnforce(t, e, "bob", "domain2", "data1", "read", false) |
| 681 | testDomainEnforce(t, e, "bob", "domain2", "data1", "write", false) |
| 682 | testDomainEnforce(t, e, "bob", "domain2", "data2", "read", true) |
| 683 | testDomainEnforce(t, e, "bob", "domain2", "data2", "write", true) |
| 684 | } |
| 685 | |
| 686 | func TestAllMatchModel(t *testing.T) { |
| 687 | e, _ := NewEnforcer("examples/rbac_with_all_pattern_model.conf", "examples/rbac_with_all_pattern_policy.csv") |
nothing calls this directly
no test coverage detected
searching dependent graphs…