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

Function TestExplicitPriorityModify

rbac_api_test.go:494–515  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

492}
493
494func TestExplicitPriorityModify(t *testing.T) {
495 e, _ := NewEnforcer("examples/priority_model_explicit.conf", "examples/priority_policy_explicit.csv")
496
497 testEnforce(t, e, "bob", "data2", "write", true)
498 _, err := e.AddPolicy("1", "bob", "data2", "write", "deny")
499 if err != nil {
500 t.Fatalf("AddPolicy: %v", err)
501 }
502 testEnforce(t, e, "bob", "data2", "write", false)
503
504 _, err = e.DeletePermissionsForUser("bob")
505 if err != nil {
506 t.Fatalf("DeletePermissionForUser: %v", err)
507 }
508 testEnforce(t, e, "bob", "data2", "write", true)
509
510 _, err = e.DeleteRole("data2_allow_group")
511 if err != nil {
512 t.Fatalf("DeleteRole: %v", err)
513 }
514 testEnforce(t, e, "bob", "data2", "write", false)
515}
516
517func TestCustomizedFieldIndex(t *testing.T) {
518 e, _ := NewEnforcer("examples/priority_model_explicit_customized.conf",

Callers

nothing calls this directly

Calls 5

AddPolicyMethod · 0.95
DeleteRoleMethod · 0.95
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…