> For the complete documentation index, see [llms.txt](https://docs.fortifiedid.se/pipes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fortifiedid.se/pipes/valves/ldap/ldap-modify.md).

# LDAP Modify

Valve for modifying entries in LDAP v3 directories

## Introduction

Use this valve to modify an LDAP entry based on values in an item.

An LDAP modify request contains one or more modifications that are applied to the target entry. The following modification types are supported

* ADD
* REPLACE
* DELETE

Each modification uses the name and the value of a property on the current item and therefor item property names must match the LDAP entry names (specified in the LDAP schema). By default the item id is used as the distinguished name (DN) of the entry to modify. If `dn_parameter` is set, that value is used instead.

## Prerequisites

Before using this valve the [LdapClient](https://docs.fortifiedid.se/ldapclient) module must be configured and deployed.

## Configuration

{% hint style="info" %}
**Valve name:** `LDAPModify`
{% endhint %}

Common LDAP valve configuration can be found [here](/pipes/valves/ldap.md).

{% tabs %}
{% tab title="Properties" %}

<table><thead><tr><th width="204.5">Name</th><th width="228">Description</th><th width="135">Default value</th><th width="126" data-type="checkbox">Mandatory</th><th width="122" data-type="checkbox">Expanded</th></tr></thead><tbody><tr><td><code>add</code></td><td>List of item properties to add.</td><td>N/A</td><td>false</td><td>false</td></tr><tr><td><code>replace</code></td><td>List of item properties to replace.</td><td>N/A</td><td>false</td><td>false</td></tr><tr><td><code>delete</code></td><td>List of item properties to delete.</td><td>N/A</td><td>false</td><td>false</td></tr><tr><td><code>ignore_empty_values</code></td><td>Ignore empty values in <code>add</code> and <code>replace</code> modifications. If all configured attributes have empty values the LDAP request is skipped and the valve succeeds without error.</td><td>false</td><td>false</td><td>false</td></tr><tr><td><code>dn_parameter</code></td><td>If not using <code>item.id()</code> as DN value.</td><td>N/A</td><td>false</td><td>true</td></tr></tbody></table>
{% endtab %}

{% tab title="Example" %}

```json
{
  "name" : "LDAPModify",
  "config" : {
    "destination" : "default",
    "dn_parameter" : "${item.dn}",
    "add" : "mail,mobile"
  }
}
```

{% endtab %}
{% endtabs %}

## Audit

When [AuditModule](https://docs.fortifiedid.se/audit) is active and the LdapClient is configured with `"update": true`, each successful modify operation emits an audit event.

Requires `"update": true` in the LdapClient [audit configuration](https://docs.fortifiedid.se/ldapclient).

{% tabs %}
{% tab title="Valve config" %}

```json
{
  "name": "LDAPModify",
  "config": {
    "replace": ["cn"]
  }
}
```

{% endtab %}

{% tab title="Audit event" %}

```json
{
  "operation": "update",
  "client_type": "ldap",
  "data_source": "default",
  "entity_type": "entry",
  "entity_id": "uid=demo,dc=example,dc=com",
  "principal": { "subject": "demo-actor@example.com" },
  "changes": [
    { "name": "cn", "action": "replace", "value": "Demo User Modified" }
  ]
}
```

{% endtab %}
{% endtabs %}

* `entity_id` — the DN of the modified entry, taken from `item.id()`
* `changes` — one entry per attribute in `add`, `replace`, or `delete`; `action` reflects the modification type
