feat(account-delete): refuse when caller is sole admin #85

Merged
nrupard merged 1 commit from feat/account-deletion into main 2026-05-13 18:33:21 +02:00
Owner

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

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>
feat(account-delete): refuse when caller is sole admin
Some checks failed
Check / clippy + fmt + tests (pull_request) Failing after 11s
4531575f42
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>
nrupard deleted branch feat/account-deletion 2026-05-13 18:33:21 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/lets-chat!85
No description provided.