# Bug OP-19734 - Users can deleted descendent work packages in projects they are not authorized to

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

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Modules and project features / Relations and scheduling, Modules and project features / Work packages |
| Target versions | 17.7.0 |
| Observed in versions |  |
| Sprint |  |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| 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 | Oliver Günther |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

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

## Costs

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

## Description

### Steps to reproduce

1.  Login as a user with permissions to delete work packages in project A
    
2.  Have a work package in project A
    
3.  That work package has a child in project B
    
4.  The user cannot delete work packages in B
    
5.  Delete the work package in A
    

### What is the buggy behavior?

*   Deletion works
    
*   Deletion of the work package in B is performed
    

### What is the expected behavior?

*   Unset the relationships for descendants you cannot see
    

**Case 1: There are no descendants.**

*   Title: as is
    
*   &quot;Are you sure you want to delete {work package name}?&quot;
    
*   Checkbox: &quot;I confirm that the work package and all associated data will be deleted.&quot;
    

**Case 2: I can see all descendants.**

*   Title: as is
    
*   &quot;Are you sure you want to delete {work package name}?&quot;
    
*   Warning: no warning
    
*   Checkbox: &quot;I confirm that all descendants listed above will also be deleted.&quot;
    

**Case 3: I can&#x27;t see some descendants:**

*   Title: as is
    
*   Text: &quot;Are you sure you want to delete {work package name}?&quot;
    
*   Warning: &quot;All visible descendants will be deleted. However, this work package has {n} descendants that you cannot see. They will not be deleted but the relation will be removed.&quot;
    
*   Checkbox: &quot;I confirm that all descendants listed above will also be deleted.&quot;
    

**Case 4: I can&#x27;t delete some descendants / I can&#x27;t delete AND can&#x27;t view some descendants:**

*   Title: as is
    
*   Text: &quot;Are you sure you want to delete {work package name}?&quot;
    
*   Warning: &quot;%{count} descendants cannot be deleted because you lack the necessary permissions. These will be not be deleted but any hierarchical relations will be removed.&quot;
    
*   Checkbox: &quot;I confirm that all descendants listed above will also be deleted.&quot;
    

<br>

**Case 5: I can&#x27;t see some descendants, but in bulk mode:**

*   Title: as is
    
*   Text: &quot;Are you sure you want to delete the selected work packages and all visible descendants?&quot;
    
*   Warning: &quot;All visible descendants will be removed. However, there are {n} descendants that you cannot see. They will not be deleted but the relation will be removed.&quot;
    
*   Checkbox: &quot;I confirm that all descendants listed above will also be deleted.&quot;
    

In warning banner, add links to the project names.

<br>
