feat(account-delete): refuse when caller is sole admin #85
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/account-deletion"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add a last-admin guard to the self-serve account deletion path. The first-user auto-promote in promote_first_user_to_admin only fires when the users table holds a single row, so deleting the sole admin while non-admin accounts remain would leave the instance permanently admin-less short of a manual DB edit. The new check refuses the request and tells the caller to promote another user first; a sole admin who is also the only user in the system is still allowed to delete because the next registration will be auto-promoted.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com