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

Function TestRBACModelInMemoryIndeterminate

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

Source from the content-addressed store, hash-verified

104}
105
106func TestRBACModelInMemoryIndeterminate(t *testing.T) {
107 m := model.NewModel()
108 m.AddDef("r", "r", "sub, obj, act")
109 m.AddDef("p", "p", "sub, obj, act")
110 m.AddDef("g", "g", "_, _")
111 m.AddDef("e", "e", "some(where (p.eft == allow))")
112 m.AddDef("m", "m", "g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act")
113
114 e, _ := NewEnforcer(m)
115
116 _, _ = e.AddPermissionForUser("alice", "data1", "invalid")
117
118 testEnforce(t, e, "alice", "data1", "read", false)
119}
120
121func TestRBACModelInMemory(t *testing.T) {
122 m := model.NewModel()

Callers

nothing calls this directly

Calls 5

AddDefMethod · 0.95
AddPermissionForUserMethod · 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…