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

Function TestMatchingFuncOrder

rbac/default-role-manager/role_manager_test.go:311–330  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

309}
310
311func TestMatchingFuncOrder(t *testing.T) {
312 rm := NewRoleManager(10)
313 rm.AddMatchingFunc("regexMatch", util.RegexMatch)
314
315 _ = rm.AddLink("g\\d+", "root")
316 _ = rm.AddLink("u1", "g1")
317 testRole(t, rm, "u1", "root", true)
318
319 _ = rm.Clear()
320
321 _ = rm.AddLink("u1", "g1")
322 _ = rm.AddLink("g\\d+", "root")
323 testRole(t, rm, "u1", "root", true)
324
325 _ = rm.Clear()
326
327 _ = rm.AddLink("u1", "g\\d+")
328 testRole(t, rm, "u1", "g1", true)
329 testRole(t, rm, "u1", "g2", true)
330}
331
332func TestDomainMatchingFuncWithDifferentDomain(t *testing.T) {
333 rm := NewRoleManager(10)

Callers

nothing calls this directly

Calls 5

AddMatchingFuncMethod · 0.95
AddLinkMethod · 0.95
ClearMethod · 0.95
testRoleFunction · 0.85
NewRoleManagerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…