#41 [Admin Panel] User Management API - Delete/Deactivate User

closed critical Created 2025-11-27 07:12 · Updated 2025-11-27 08:27

Description

Edit
Implement DELETE /api/v1/admin/users/<user_id> endpoint to delete or deactivate users. **API Specification:** - Endpoint: DELETE /api/v1/admin/users/<user_id> - Permission Required: manage_users - Path Parameter: user_id (UUID) - Query Parameter: hard_delete (bool, default: false) - Response: {success: true, action: 'deactivated' | 'deleted'} **Soft Delete (default):** - Set is_active = false - Revoke all active tokens - Terminate all sessions - Keep user data for audit trail - User cannot login but data preserved **Hard Delete (hard_delete=true):** - Only allowed for users with no workflow history - Permanently remove user record - Remove from all role assignments - Anonymize audit logs (replace email with 'deleted_user_<uuid>') **Requirements:** - Cannot delete yourself - Cannot delete last tenant_admin - Warn if user has active workflows - Log audit event **IMPORTANT:** Implement with ultra attention to details and correctness. **BEFORE CLOSING:** Take screenshot showing user deletion. Add comment summarizing implementation.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...