(t *testing.T)
| 407 | } |
| 408 | |
| 409 | func TestImplicitUserAPI(t *testing.T) { |
| 410 | e, _ := NewEnforcer("examples/rbac_model.conf", "examples/rbac_with_hierarchy_policy.csv") |
| 411 | |
| 412 | testGetImplicitUsers(t, e, []string{"alice"}, "data1", "read") |
| 413 | testGetImplicitUsers(t, e, []string{"alice"}, "data1", "write") |
| 414 | testGetImplicitUsers(t, e, []string{"alice"}, "data2", "read") |
| 415 | testGetImplicitUsers(t, e, []string{"alice", "bob"}, "data2", "write") |
| 416 | |
| 417 | e.ClearPolicy() |
| 418 | _, _ = e.AddPolicy("admin", "data1", "read") |
| 419 | _, _ = e.AddPolicy("bob", "data1", "read") |
| 420 | _, _ = e.AddGroupingPolicy("alice", "admin") |
| 421 | testGetImplicitUsers(t, e, []string{"alice", "bob"}, "data1", "read") |
| 422 | } |
| 423 | |
| 424 | func testGetImplicitResourcesForUser(t *testing.T, e *Enforcer, res [][]string, user string, domain ...string) { |
| 425 | t.Helper() |
nothing calls this directly
no test coverage detected
searching dependent graphs…