Admin: allow changing your own quota
The self-protection guard refused every change to the admin's own account. It now only refuses blocking and deleting yourself; a quota change is fine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -168,6 +168,20 @@ async def test_admin_cannot_block_or_delete_themselves(world: World) -> None:
|
||||
assert (await c.delete(f"/api/admin/users/{admin.id}")).status_code == 409
|
||||
|
||||
|
||||
async def test_admin_can_change_their_own_quota(world: World) -> None:
|
||||
admin = await world.user(admin=True)
|
||||
async with await world.client(admin) as c:
|
||||
resp = await c.patch(f"/api/admin/users/{admin.id}", json={"quota_bytes": 5 * 2**30})
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["quota_bytes"] == 5 * 2**30
|
||||
# Quota together with a block is still refused: the block is the problem.
|
||||
assert (
|
||||
await c.patch(
|
||||
f"/api/admin/users/{admin.id}", json={"quota_bytes": 2**30, "blocked": True}
|
||||
)
|
||||
).status_code == 409
|
||||
|
||||
|
||||
async def test_delete_removes_the_user_and_their_data(world: World, bus: _Bus) -> None:
|
||||
admin = await world.user(admin=True)
|
||||
target = await world.user()
|
||||
|
||||
Reference in New Issue
Block a user