mirror of
https://github.com/SigNoz/signoz.git
synced 2026-08-23 13:10:30 +01:00
#### Description - Soft-deleting a user revoked the FGA grant but left the `user_role` rows behind. The role-delete guard (`OnBeforeRoleDelete` → `GetUsersByOrgIDAndRoleID`) still counted the deleted user, so the role could never be deleted — and detaching the assignment was also blocked because the user is deleted. That left the role permanently undeletable. - `SoftDeleteUser` now deletes the user's `user_role` rows in the same transaction that already clears its password, tokens, and preferences, so the SQL side matches the FGA revoke. - Migration `delete_orphan_user_roles` clears the orphan `user_role` rows left by users deleted before this change. #### Additional Information - Regression test in `role/02_crud.py`: assign a custom role to a user, delete the user, then delete the role → now `204` (was the deadlock).