(t *testing.T)
| 224 | } |
| 225 | |
| 226 | func TestRBACModelWithDomainsAtRuntimeMockAdapter(t *testing.T) { |
| 227 | adapter := fileadapter.NewAdapterMock("examples/rbac_with_domains_policy.csv") |
| 228 | e, _ := NewEnforcer("examples/rbac_with_domains_model.conf", adapter) |
| 229 | |
| 230 | _, _ = e.AddPolicy("admin", "domain3", "data1", "read") |
| 231 | _, _ = e.AddGroupingPolicy("alice", "admin", "domain3") |
| 232 | |
| 233 | testDomainEnforce(t, e, "alice", "domain3", "data1", "read", true) |
| 234 | |
| 235 | testDomainEnforce(t, e, "alice", "domain1", "data1", "read", true) |
| 236 | _, _ = e.RemoveFilteredPolicy(1, "domain1", "data1") |
| 237 | testDomainEnforce(t, e, "alice", "domain1", "data1", "read", false) |
| 238 | |
| 239 | testDomainEnforce(t, e, "bob", "domain2", "data2", "read", true) |
| 240 | _, _ = e.RemovePolicy("admin", "domain2", "data2", "read") |
| 241 | testDomainEnforce(t, e, "bob", "domain2", "data2", "read", false) |
| 242 | } |
| 243 | |
| 244 | func TestRBACModelWithDomainTokenRename(t *testing.T) { |
| 245 | // Test that renaming the domain token from "dom" to another name (e.g., "dom1") |
nothing calls this directly
no test coverage detected
searching dependent graphs…