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

Function TestAllMatchModel

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

Source from the content-addressed store, hash-verified

684}
685
686func TestAllMatchModel(t *testing.T) {
687 e, _ := NewEnforcer("examples/rbac_with_all_pattern_model.conf", "examples/rbac_with_all_pattern_policy.csv")
688 e.AddNamedMatchingFunc("g", "keyMatch2", util.KeyMatch2)
689 e.AddNamedDomainMatchingFunc("g", "keyMatch2", util.KeyMatch2)
690
691 testDomainEnforce(t, e, "alice", "domain1", "/book/1", "read", true)
692 testDomainEnforce(t, e, "alice", "domain1", "/book/1", "write", false)
693 testDomainEnforce(t, e, "alice", "domain2", "/book/1", "read", false)
694 testDomainEnforce(t, e, "alice", "domain2", "/book/1", "write", true)
695}
696
697func TestTemporalRolesModel(t *testing.T) {
698 e, _ := NewEnforcer("examples/rbac_with_temporal_roles_model.conf", "examples/rbac_with_temporal_roles_policy.csv")

Callers

nothing calls this directly

Calls 4

AddNamedMatchingFuncMethod · 0.95
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…