MCPcopy
hub / github.com/apache/casbin / TestRBACModelWithDomains

Function TestRBACModelWithDomains

model_test.go:168–179  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

166}
167
168func TestRBACModelWithDomains(t *testing.T) {
169 e, _ := NewEnforcer("examples/rbac_with_domains_model.conf", "examples/rbac_with_domains_policy.csv")
170
171 testDomainEnforce(t, e, "alice", "domain1", "data1", "read", true)
172 testDomainEnforce(t, e, "alice", "domain1", "data1", "write", true)
173 testDomainEnforce(t, e, "alice", "domain1", "data2", "read", false)
174 testDomainEnforce(t, e, "alice", "domain1", "data2", "write", false)
175 testDomainEnforce(t, e, "bob", "domain2", "data1", "read", false)
176 testDomainEnforce(t, e, "bob", "domain2", "data1", "write", false)
177 testDomainEnforce(t, e, "bob", "domain2", "data2", "read", true)
178 testDomainEnforce(t, e, "bob", "domain2", "data2", "write", true)
179}
180
181func TestRBACModelWithDomainsAtRuntime(t *testing.T) {
182 e, _ := NewEnforcer("examples/rbac_with_domains_model.conf")

Callers

nothing calls this directly

Calls 2

NewEnforcerFunction · 0.85
testDomainEnforceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…