18 July, 2012

Custom LDAP attributes import

Hi Everyone,
If you want to import LDAP extra attributes in liferay , then you can achive this functionality two different ways :



1) If you are using LR 6.X then you can directly map your custom field attribute with LDAP by setting below property in portal-ext.properties file :

ldap.user.custom.mappings.0=phone,address

Here phone and address will be key of custom attributes which can be created from control panel.
So in this case you dont need to change any code.Please see below screen


For other LDAP import export you can check  http://www.liferaysolution.com/2012/07/ldap-import-export.html

2) if you want use existing liferay fields phone number and address then you may have to map these new fieldsin portal-ext.properties like :

ldap.user.mappings.0=uuid=uuid\nscreenName=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title\ngroup=groupMembership\naddres=addressLDAP\nphone=phoneLDAP

Here addressLDAP & phoneLDAP will be attributes of your LDAP schema and you can access this value in PortalLDAPImporterUtil class (importFromLDAP method).
So you may have to override this class and
Here you can get this value using : GetterUtil.getString(userMappings.getProperty("addres")).toLowerCase()

Rate Me:

Create Servlet Project as Module

You would have seen that many times we are writing out own servlet in Liferay portal to achieve some specific use case. In DXP, You can st...