Issue
- Is there any way to map a custom attribute in Liferay created from MS Active Directory?
Environment
- Liferay Portal 6.2
Resolution
-
Liferay provides an OOTB option to achieve the custom attribute mapping.
#
# When importing and exporting users, the portal will use this mapping to
# connect LDAP user attributes and portal user's custom attributes.
#
#ldap.user.custom.mappings.0=At MS Active Directory side:
- Open CMD with “Run as Administrator”.
- Type regsvr32 schmmgmt.dll and hit enter
- Click Start, click Run, type mmc, and click OK
- On the File menu, click Add/Remove Snap-in
- Under Available snap-ins, click Active Directory Schema, click Add, and then click OK
- Click on Attributes, type Common Name (ex. testcustom), Under syntax select “Unicode String” and Under Unique X500 object ID enter 1.2.840.113.556.1.4.2010, click ok
- Click on Classes, select User> Attribute> Add
- Select a custom attribute and click ok, then click on Apply and then ok
- Click Start> Services and restart “Apache Directory domain services”.
- Now, if you are not able to find the custom attribute tab, click on Start> Administrative tools> Active Directory Users and Computers and click on view from the top and select Advance Features. Now you can see the custom attribute in the users properties>Attribute Editor.
- Click on your custom attribute and provide the value
At Liferay Side:
- Create Custom field (Control panel>Custom fields> Add custom fields) ex. Akash_custom
- From UI-> Under custom user mapping field type Custom field key= custom attribute (ex. akash_custom=testcustom)From portal-ext.properties-> set ldap.user.custom.mappings.0=akash_custom=testcustom