MCPcopy Index your code
hub / github.com/apache/casbin / TestRBACModelWithCustomRoleManager

Function TestRBACModelWithCustomRoleManager

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

Source from the content-addressed store, hash-verified

504}
505
506func TestRBACModelWithCustomRoleManager(t *testing.T) {
507 e, _ := NewEnforcer("examples/rbac_model.conf", "examples/rbac_policy.csv")
508 e.SetRoleManager(NewRoleManager())
509 _ = e.LoadModel()
510 _ = e.LoadPolicy()
511
512 testEnforce(t, e, "alice", "data1", "read", true)
513 testEnforce(t, e, "alice", "data1", "write", false)
514 testEnforce(t, e, "alice", "data2", "read", true)
515 testEnforce(t, e, "alice", "data2", "write", true)
516 testEnforce(t, e, "bob", "data1", "read", false)
517 testEnforce(t, e, "bob", "data1", "write", false)
518 testEnforce(t, e, "bob", "data2", "read", false)
519 testEnforce(t, e, "bob", "data2", "write", true)
520}
521
522func TestKeyMatchModel(t *testing.T) {
523 e, _ := NewEnforcer("examples/keymatch_model.conf", "examples/keymatch_policy.csv")

Callers

nothing calls this directly

Calls 6

SetRoleManagerMethod · 0.95
LoadModelMethod · 0.95
LoadPolicyMethod · 0.95
NewEnforcerFunction · 0.85
testEnforceFunction · 0.85
NewRoleManagerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…