feat: Users API, ownership transfer and removal of the legacy role string
This commit is contained in:
1 parent
094df63a7f
commit
80f7037d3a
124 files changed
+4644
-824
No files matched your search
@@ -601,14 +601,17 @@ func TestContentScopeRequestLoads(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
t.Run("A legacy owner is resolved by one GetByName and no List call", func(t *testing.T) {
|
||||
t.Run("A user with role_id 0 is denied without any role load", func(t *testing.T) {
|
||||
world := newContentScopeWorld(t)
|
||||
legacy := world.users.users[csOwner]
|
||||
legacy.RoleID = 0
|
||||
world.users.users[csOwner] = legacy
|
||||
bare := world.users.users[csOwner]
|
||||
bare.RoleID = 0
|
||||
world.users.users[csOwner] = bare
|
||||
world.resetCounters()
|
||||
assertScopeWant(t, world.do(t, csOwner, http.MethodPatch, "/v1/article/10", csArticlePatch), okWant(200))
|
||||
if world.roleRepo.getByNames != 1 || world.roleRepo.gets != 0 || world.roleRepo.lists != 0 {
|
||||
rec := world.do(t, csOwner, http.MethodPatch, "/v1/article/10", csArticlePatch)
|
||||
if rec.Code != http.StatusForbidden || rec.Body.String() != "missing_permission\n" {
|
||||
t.Errorf("expected 403 missing_permission, got %d %q", rec.Code, rec.Body.String())
|
||||
}
|
||||
if world.roleRepo.touched() != 0 {
|
||||
t.Errorf("unexpected role loads %+v", world.roleRepo)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user