# Bug OP-8289 - Deletion of users and groups is incomplete and results in corrupted data

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-8289

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | High |
| Module |  |
| Target versions | 11.2.0 |
| Observed in versions | 11.2.0 |
| Sprint | 11.2.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 11.2.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

Identified issues

*   [ ] Custom fields of type User become broken when a user (and with 11.2 group) gets deleted that was a value.
*   [ ] On deleting a group it does not get replaced by DeletedUser when the group was set as responsible for a WP.

Steps to be taken

*   [ ]  Migration: All custom values that still reference non existing principals are to be replaced by the ID of DeletedUser.
*   [ ]  Migration: All `responsible` values that still reference non existing principals are set to nil/null.
*   [ ]  Refactoring: All deletion logic shall get consolidated into one `Principals::ReplaceReferencesJob`
*   [ ]  Refactoring: Consolidated all deletion logic to use the new `Principals::ReplaceReferencesJob`
    *   [ ]  Users
    *   [ ]  Groups
    *   [ ]  PlaceholderUsers
