(t *testing.T)
| 698 | } |
| 699 | |
| 700 | func TestConditional(t *testing.T) { |
| 701 | e, _ := NewEnforcer("examples/rbac_with_domains_conditional_model.conf", "examples/rbac_with_domains_conditional_policy.csv") |
| 702 | g, _ := e.GetNamedGroupingPolicy("g") |
| 703 | for _, gp := range g { |
| 704 | e.AddNamedDomainLinkConditionFunc("g", gp[0], gp[1], gp[2], util.TimeMatchFunc) |
| 705 | } |
| 706 | |
| 707 | testDomainEnforce(t, e, "alice", "domain1", "service1", "/list", true) |
| 708 | testDomainEnforce(t, e, "bob", "domain2", "service2", "/broadcast", true) |
| 709 | testDomainEnforce(t, e, "jack", "domain1", "service1", "/list", false) |
| 710 | testGetImplicitRolesInDomain(t, e, "alice", "domain1", []string{"test1"}) |
| 711 | testGetRolesInDomain(t, e, "alice", "domain1", []string{"test1"}) |
| 712 | testGetUsersInDomain(t, e, "test1", "domain1", []string{"alice"}) |
| 713 | } |
| 714 | |
| 715 | func TestMaxHierarchyLevelConsistency(t *testing.T) { |
| 716 | // Test consistency behavior under different maxHierarchyLevel values |
nothing calls this directly
no test coverage detected
searching dependent graphs…