留言板

Trigger LDAP User Export on User Creation

Marc Grünewald,修改在11 年前。

Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
Hello everybody,

I configured LDAP in Liferay more or less sucessfully. The Import works perfect but I have a little Issue with the Export. We create Customer Users from a Custom Portlet and want to export that User to our OpenLDAP Server right away. Right now, I'd have to login with that user first in order for this Operation to be triggered. Is there any way to change that?

EDIT:

Also, is there a possibility to add Attributes to map? Like right now, only things like the screenname, mail, pw, uuid, etc. are available from the edit Screen. But what if I want to maybe map a Custom Field of a User to Attribute of my LDAP Server? e.g. I have a Custom Field called CustomerUser, which is a boolean value, and I want that value to be set, when Liferay imports Users via LDAP. Is this possible?

Best Regards

Marc
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
you can visit very simple article to setup it :
http://www.liferaysolution.com/2012/07/ldap-import-export.html
Let me know if still you confused.
Marc Grünewald,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
Hello and thanks for the quick response. However, the Configuration is already done, it's just that the export Function is only triggered when I log in with the newly created User. But that's not what I want. I want Liferay to start the Export, right after I created the User with UserLocalServiceUtil.addUser(....).

Regards

Marc
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
Yes it would export when you create new user if you have made export setting properly emoticon
Marc Grünewald,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
Again, thanks for the fast reply. But I did configure it the way shown in your Post.
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
Marc

I think there is some problem in User DN for export section.

Which User DN you are using ?
thumbnail
Pinkesh Gandhi,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 99 加入日期: 12-1-27 最近的帖子
Hi Marc,

In addition of Jignesh' reply, I would like to share one more thing with you.

The LDAP export will be triggered if and only if you add/update user's data in your portlet by using any one of the UserLocalServiceUtil/UserServiceUtil/ContactLocalServiceUtil/ContactServiceUtil.

I hope this may helps you.

Let me know if you have any query.
Marc Grünewald,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
Hello and thanks once more for the replies. I'm using UserLocalServiceUtil.addUser(...). BUt even after adding a User via the Control Panel, the User only gets exported on first login.

Regards

Marc
thumbnail
Pinkesh Gandhi,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 99 加入日期: 12-1-27 最近的帖子
Hi,

Please make sure that you have checked the check box for Enable option under Authentication - LDAP as shown in following image.
Marc Grünewald,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
Hello,

well "Enabled" is already checked. Any other Ideas?

Regards

Marc
thumbnail
Pinkesh Gandhi,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 99 加入日期: 12-1-27 最近的帖子
Can you please debug code and please verify that on calling UserLocalServiceUtil.addUser(...) method, the exportToLDAP(...) method of UserListener class is called or not.

If so then subsequently you can check exportToLDAP(....) method of PortalLDAPExporterUtil.

I hope this might helps you.
Marc Grünewald,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
Hello,

I'm currently debugging. However I noticed that only the PortalLDAPImporterUtil class is available from the portal Services. However there is no PortalLDAPExporterUtil-class. This is probalby due to the fact, that this class isn't in the portal-service.jar right? If so, is it possible to invoke the Method with a Method-Key or something?

Regards

Marc
thumbnail
Pinkesh Gandhi,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 99 加入日期: 12-1-27 最近的帖子
Hi Mark,

If you are using Liferay 6.x then the PortalLDAPExporterUtil.java must be available in portal-impl.jar.
And that will be called from UserListener.java so irrespective of context from where you are using UserLocalServiceUtil.addUser(...) the PortalLDAPExporterUtil.exportToLDAP(....) method will be executed.

But first you need to verify by debugging that on calling UserLocalServiceUtil.addUser(...) the method exportToLDAP(...) of UserListener is called or not.

So can you please verify it.
Marc Grünewald,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
Hello and thanks again. For some reason it's exporting on creation now. My Problem is however, that the password field isn't exported to LDAP. Theres a new Entry in LDAP but with a blank pw field. When Liferay and LDAP synchronize after the default 10 min intervall, the pw in liferays db gets overwritten by the blank pw of LDAP and I can't login anymore...

Regards

Marc
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
you must have set userPassword paramater available in your LDAP schema which would be imported in LDAP.
So During LDAP import , ideally it will give exception in server console i think.
Please check your server console , there would be some error when its getting import or export.
Marc Grünewald,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
You guys are really fast emoticon. I managed to narrow it down a bit. While creating users with the "addUser()"-method, I don't assign a password at first, so no Problem here. I implemented something like an "activate" button that actually activates the user in Liferay(sets the active status) and updates the pw of the User. And here my Implementation is probably wrong. I update the Password using the UserLocalServiceUtil.updatePasswordManually(...) Method which probably doesn't call the export function.

Regards

Marc
Marc Grünewald,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
Hmm when I assign a Password using the edit function of a user in the control Panel, the attribute is set on the LDAP Server. Does anyone know, how the Password is updated there, so I could implement it the same way?

Regards

Marc
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
You can check implementation in UserLocalserviceImpl class where updatePassword method is exist which could have you this implementation
thumbnail
Pinkesh Gandhi,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 99 加入日期: 12-1-27 最近的帖子
Again, you can check UserListener.exportToLDAP(...) method.

As when you are assigning password using edit function of a user in control panel, the UserLocalServiceImpl.updateUser(...) method will be called and hence UserListener.onAfterUpdate(...) method will be executed in a separate thread.
Marc Grünewald,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Junior Member 帖子: 45 加入日期: 12-3-20 最近的帖子
Thank you both it seems to work now. I really appreciate your help. Have a nice day!

Regards

Marc
thumbnail
Jignesh Vachhani,修改在11 年前。

RE: Trigger LDAP User Export on User Creation

Liferay Master 帖子: 803 加入日期: 08-3-10 最近的帖子
Marc,
Glad to hear this news .emoticon
Shiva Krish,修改在7 年前。

RE: Trigger LDAP User Export on User Creation

New Member 发布: 1 加入日期: 16-7-12 最近的帖子
Hi
I am using Liferay 6.2 and facing issue in creating user after checking export enabled.Can somebody help on this.


Thanks
Shiva