Files
bookhoard/bruno/user/Delete User Account (Admin).bru
T
john-okeefe 71584c1b55 feat: Enhance admin user management system
- Add admin override capability to DELETE /api/auth/account endpoint
- Move /api/auth/users to admin-only with complete user fields (first_name, last_name, role, theme)
- Consolidate Bruno requests: remove duplicate List Users (Admin), merge Delete Account functionality
- Update all documentation to reflect enhanced capabilities
- Implement pgx 5 standards compliance with proper error handling

BREAKING CHANGES:
- /api/auth/users endpoint now requires admin role (was previously accessible)
- DELETE /api/auth/account accepts optional user_id parameter for admin deletion
2026-01-27 13:36:11 -05:00

54 lines
1.4 KiB
Plaintext

meta {
name: Delete User Account (Admin)
type: http
seq: 6
}
delete {
url: {{base_url}}/api/auth/account?user_id={{user_id}}
body: none
auth: inherit
}
settings {
encodeUrl: true
timeout: 0
}
docs {
## Delete User Account (Admin)
Allows administrators to delete any user account by specifying user_id parameter.
**Method:** DELETE
**Endpoint:** /api/auth/account?user_id={user_id}
**Authentication:** Required (Admin only)
**Query Parameters:**
- `user_id` (string, required for admin): UUID of the user account to delete
**Usage Examples:**
- **Self-deletion**: DELETE /api/auth/account (no user_id parameter)
- **Admin deletion**: DELETE /api/auth/account?user_id=550e8400-e29b-41d4-a716-446655440000
**Response:**
- `message` (string): Success message indicating which account was deleted
**Status Codes:**
- 200: Success
- 400: Bad Request (invalid user_id or attempting to delete last admin)
- 401: Unauthorized
- 403: Forbidden (admin access required for user_id parameter)
- 404: Not Found (user does not exist)
**Admin Protection Rules:**
- Regular users can only delete their own account (no user_id parameter allowed)
- Admins can delete any account including their own
- Cannot delete the last admin account in the system
- Admin role required to use user_id parameter
**Variables:**
- `user_id`: Set this to the UUID of the user you want to delete
}