# Bug OP-9018 - Inherited role memberhips are not cleaned up if user is removed from a group via LDAP sync

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

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 11.3.5 |
| Observed in versions |  |
| Sprint | 11.3.5 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 11.3.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

### **Environment**:

Your OpenProject Version: 11.3.3 / Community Edition with Enterprise Token

Operating System / Browser / OpenProject language: Openshift/CentOS / irrelevant / irrelevant

### **Logs**

Are there errors in the browser console? ([Click here for information on how to open your browser's console](https://webmasters.stackexchange.com/a/77337)) For a local installation: Are there relevant logs output by `openproject logs` (packaged installation) ([click here for details](https://docs.openproject.org/installation-and-operations/operation/monitoring/#show-logs)) or in a log/production.log or /var/log/openproject/ ? Please attach error output in these log files if applicable

Logs from step 3:

``` text
I, [2021-08-12T21:24:43.684340 #112]  INFO -- : [LDAP groups] Adding 1 users to cn=rg-pirmasens-admin,cn=groups,cn=accounts,dc=typeerror,dc=eu
I, [2021-08-12T21:24:43.834688 #112]  INFO -- : [ActiveJob] Enqueued Notifications::GroupMemberAlteredJob (Job ID: 3e497bda-33ff-4287-bdf8-14774f556f45) to DelayedJob(default)
```

Logs from step 5:

``` text
I, [2021-08-12T21:26:10.212892 #122]  INFO -- : [LDAP groups] Removing users [8] from cn=rg-pirmasens-admin,cn=groups,cn=accounts,dc=typeerror,dc=eu
```

### **Steps to reproduce:**

1.  Create project X and group B, set group B as role Y in project X
2.  Set up LDAP group sync for group B
3.  Add user A to group B in LDAP, wait until OP groups are synced
4.  Verify that A has inherited the role Y in project X
5.  Remove user A from group B in LDAP, wait until OP groups are synced
6.  Check the role of A in project X

### **Actual Behavior**

User A still has an "inherited" / **non-editable** role Y in project X

### **Expected Behavior**

User A has no role in project X

#### Workaround

As the role is non-editable, problem can only be solved by either:

  - Removing role Y of group B in project X (works despite A not being a member of B anymore)
  - Readding user A to group B using the WebUI and the removing A from B again (instead of doing it in LDAP)
