Foren

Adapt ldap export management

Mickael ROMME, geändert vor 6 Jahren.

Adapt ldap export management

New Member Beiträge: 15 Beitrittsdatum: 05.05.17 Neueste Beiträge
Hi,

I'm using the Liferay release 7.0 G4 and I found a bug during the user creation process and the export to my OpenLDAP.
When we create a user in Liferay, the user is created in Liferay database and exported to the LDAP. But the export is done without userPassword in the first time.
The password is send by mail to the user and when he change its password, Liferay try to export the user in the LDAP with the password. But there is an error because all other informations ahave been already created before. Liferay should only add the password field.

So I want to adapt the export of users to LDAP. It's my first developement in Liferay. Could someone help me to identify which class I've to change ?
UserLocalServiceImpl ?

I don't know what is the best solution :
- create the userPassword field in LDAP with the temporar password
- disable the user creation when the temporar password is send to the user and wait the password modify to export the user
- sent an instruction to update userPassword field in the ldap instead of the complete user creation

Thank you for your help.

Best regards,
thumbnail
Andrew Jardine, geändert vor 6 Jahren.

RE: Adapt ldap export management

Liferay Legend Beiträge: 2416 Beitrittsdatum: 22.12.10 Neueste Beiträge
Hi Mickael,

I'm not sure that I totally agree with your expectations in terms of only exporting the fields that have changed, but regardless, your question is about how to customize the user export process, so here you go. In Liferay 7 a lot of these things are now exposed as services that you can override with your own custom components that provide the implementation. The default user exporter is found in the package com.liferay.portal.security.ldap.internal.exportimport in modules/apps/foundation/portal-security/portal-security-ldap. You can see that the component looks like this --

@Component(immediate = true, service = UserExporter.class)
public class LDAPUserExporterImpl implements UserExporter {
    ...
}


.. So in your case, if you really do need some custom export process, you should be able to create your own service module using ..

$>blade create -t service -s UserExporter -c CustomLDAPUserExporterImpl -p com.xyz.portal.security.ldap custom-ldap-user-exporter-service


Once the module is created you can provide your own definition do export the user however you need to.