#43 [Admin Panel] Role Assignment API - Remove Role

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

Description

Edit
Implement DELETE /api/v1/admin/users/<user_id>/roles/<role_name> endpoint to remove role from user. **API Specification:** - Endpoint: DELETE /api/v1/admin/users/<user_id>/roles/<role_name> - Permission Required: manage_users - Path Parameters: user_id (UUID), role_name (string) - Response: {user_id, roles: remaining_roles[]} **Requirements:** - Validate role is currently assigned to user - Prevent removing last tenant_admin from only admin user - Log audit event with role removed - Return 404 if user not found - Return 400 if role not assigned to user **Safety Checks:** - Cannot remove own tenant_admin role - Count remaining tenant_admins before removal - Warn but allow if removing last role (user becomes role-less) **IMPORTANT:** Implement with ultra attention to details and correctness. **BEFORE CLOSING:** Take screenshot showing role removal. Add comment summarizing implementation.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...