Add User To LDAP Group
This tutorial talks about how to add a user to LDAP Group.
Prerequisite:
To use the LDAP Connector, you must have the following:
- Access to either an OpenLDAP, Apache Directory, or MicroSoft Active Directory Instance.
- Anypoint Studio version 7.0 (or higher) or Anypoint Design Center.
To use the LDAP Connector in a production environment, you must have either:
- An Enterprise license to use Mule.
- A CloudHub Starter, Professional, or Enterprise account.
Below LDAP operation is present to add user to group
Add single value attribute: Adds a value for an attribute in an existing LDAP entry. If the entry already contained a value for the given attributeName then this value will be added (only if the attribute is multi value and there entry didn’t have the value already)
Add multi value attribute: If you want to add a value with a type different than String, then you can use the add-multi-value-attribute operation it adds all the values for an attribute in an existing LDAP entry.By using multi value attribute you can add single value as well as multiple values to group
Add single value attribute
Create sample project in anypoint studio and configure listener to trigger the request
Drag and drop LDAP Add single value attribute operation from mule palette if you can not find LDAP operation in mule palette please add LDAP module using Exchange visit this url for more information

Provide the Connection Details as given below:

Create the transform message to Add User to LDAP group
%dw 2.0
output application/java
---
{
"groupDN":"cn=developers,ou=Groups,dc=example,dc=com",
"attributeName":"uniqueMember",
"attributeValue":"cn=Philip Mortier,ou=Users,dc=example,dc=com"
}
Pass the below parameters to associate user to group
DN: provide the group DN value
Attribute Name: Provide the member attribute name where you want to add value
Attribute value: Provide the value of the User DN which you want to add

Deploy the project and trigger from postman/soapui

We can see below that user is added to developers LDAP group

Add multi value attribute
Drag and drop LDAP Add multi value attribute operation from mule palette if you can not find LDAP operation in mule palette please add LDAP module using Exchange visit this url for more information

Provide LDAP connection details

Create the transform message to add multiple users to group
%dw 2.0
output application/java
---
{
"groupDN":"cn=developers,ou=Groups,dc=example,dc=com",
"attributeName":"uniqueMember",
"attributeValues":["cn=John Wick,ou=Users,dc=example,dc=com","cn=David Mortier,ou=Users,dc=example,dc=com"]
}

Deploy the project and trigger from soapui/postman

We can see below that 2 users is added to developers LDAP group

Sample application: adduserstogroup sample application