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

Function TestKeyMatchModelInMemoryDeny

enforcer_test.go:92–104  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

90}
91
92func TestKeyMatchModelInMemoryDeny(t *testing.T) {
93 m := model.NewModel()
94 m.AddDef("r", "r", "sub, obj, act")
95 m.AddDef("p", "p", "sub, obj, act")
96 m.AddDef("e", "e", "!some(where (p.eft == deny))")
97 m.AddDef("m", "m", "r.sub == p.sub && keyMatch(r.obj, p.obj) && regexMatch(r.act, p.act)")
98
99 a := fileadapter.NewAdapter("examples/keymatch_policy.csv")
100
101 e, _ := NewEnforcer(m, a)
102
103 testEnforce(t, e, "alice", "/alice_data/resource2", "POST", true)
104}
105
106func TestRBACModelInMemoryIndeterminate(t *testing.T) {
107 m := model.NewModel()

Callers

nothing calls this directly

Calls 4

AddDefMethod · 0.95
NewModelFunction · 0.92
NewEnforcerFunction · 0.85
testEnforceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…