Foren

LDAP user import

Varsha Ajane, geändert vor 8 Jahren.

LDAP user import

Junior Member Beiträge: 30 Beitrittsdatum: 10.12.14 Neueste Beiträge
Hi all,

I am able to import the users from LDAP and customize them, but when I already have a user with same "FirstName", "LastName" & "EmailAddress" before importing from LDAP, that particular LDAP user is not imported after enabling LDAP import.

My requirement is like liferay should import all the users & for conflicting once it should overwrite them with the LDAP user.

Currently I have hooked UserLocalServiceImpl.java with method

public User addUser(long creatorUserId, long companyId, boolean autoPassword, String password1, String password2, boolean autoScreenName,
			String screenName, String emailAddress, long facebookId, String openId, Locale locale, String firstName, String middleName,
			String lastName, int prefixId, int suffixId, boolean male, int birthdayMonth, int birthdayDay, int birthdayYear, String jobTitle,
			long[] groupIds, long[] organizationIds, long[] roleIds, long[] userGroupIds, boolean sendEmail, ServiceContext serviceContext) {


for my customizationto LDAP users.

I am using Liferay 6.2 with Maven & tomcat server .
Kindly help me with the query.

Thanks in advance,
Varsha Ajane
thumbnail
David H Nebinger, geändert vor 8 Jahren.

RE: LDAP user import

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
Why would you have to override UserLocalServiceImpl?

addUser() is just for adding users, not for updating.

The LDAP importer is responsible for either adding/updating users. You should start your research there as to why something is not updating as you'd expect.
Varsha Ajane, geändert vor 8 Jahren.

RE: LDAP user import

Junior Member Beiträge: 30 Beitrittsdatum: 10.12.14 Neueste Beiträge
Hi David,

I had to override UserLocalServiceImpl because while importing LDAP users I have to set some expando fields and do some web service callings. Currently for existing users these fields are not updating while LDAP import.

I hope I am clear to my point this time. I'll try for LDAP importer. Though do suggest a solution.
thumbnail
David H Nebinger, geändert vor 8 Jahren.

RE: LDAP user import

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
Um, yeah, you don't need to update UserLocalServiceImpl to do any of those things.

The LDAP importer is what extracts the info from LDAP record in preparation of sending to UserLocalServiceImpl.

See that last parameter of addUser(), the ServiceContext object? Well you can store your expando values in there and the current UserLocalServiceImpl will automagically persist them for you.

As I said, the only thing you have to modify for getting everything out of LDAP is the LDAP importer.
thumbnail
David H Nebinger, geändert vor 8 Jahren.

RE: LDAP user import

Liferay Legend Beiträge: 14916 Beitrittsdatum: 02.09.06 Neueste Beiträge
Varsha Ajane:
I am able to import the users from LDAP and customize them, but when I already have a user with same "FirstName", "LastName" & "EmailAddress" before importing from LDAP, that particular LDAP user is not imported after enabling LDAP import.


Ah, changing the criteria after the fact...

You cannot have multiple users with the same email address in Liferay. Email address is unique.

Check the existing user, likely their information has been updated to reflect the info from LDAP.
Varsha Ajane, geändert vor 8 Jahren.

RE: LDAP user import (Antwort)

Junior Member Beiträge: 30 Beitrittsdatum: 10.12.14 Neueste Beiträge
Hi David,

Thank you for you suggestion. It worked emoticon.
I have created an EXT plugin project to override the LDAP importer to customize the LDAP users info while importing them. Also, for already existing users (like with same Email Address), the user just gets overwrite with the current/fresh data that is imported from the LDAP with the scheduler. So this problem is also resolved and as I have updated LDAP importer I am able to set the custom values for existing users too.