掲示板

Extending LDAPUserImporter ???

thumbnail
6年前 に Sunit Chatterjee によって更新されました。

Extending LDAPUserImporter ???

Junior Member 投稿: 28 参加年月日: 17/05/18 最新の投稿
Hi,

Can anyone give me some pointers on how to extend LDAPUserImporter?

Use Case:
1. There are few actions that we want to take on User object and its associated data once an LDAP user is imported in liferay.
2. We want to pass on the newly created User and the data read from LDAP Server, to a custom service class that populates associated custom data for every user.

The only way I could think of is
1. Extend com.liferay.portal.security.ldap.internal.exportimport.LDAPUserImporterImpl, and override the method - importUser
2. In the overridden method, I first call "super.importUser()", and then pass on the LDAP data to my custom service class that populates the user's associated data.

The only problem I faced with this approach is that I am not able to extend LDAPUserImporterImpl, probably because this may be an internal class which is not exposed.

Is there any other way to handle this use case.

Thanks
Sunit
thumbnail
6年前 に Andrew Jardine によって更新されました。

RE: Extending LDAPUserImporter ???

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Hi Sunit,

Frustrating I know. There have been several occasions to date where I have hit a wall where I am staring at a class that, in my mind, should be exported rather than hidden.

It's not pretty, and sucks for upgrade path, but you could "clone" (fancy way of saying copy and paste lol) the existing class, make your changes, and give it a higher service ranking.

Alternatively, depending on your version, EXT plugins are back -- so you could always go that route as well.
thumbnail
6年前 に David H Nebinger によって更新されました。

RE: Extending LDAPUserImporter ??? (回答)

Liferay Legend 投稿: 14915 参加年月日: 06/09/02 最新の投稿
Don't forget my blog post for how to expose an otherwise private package...

https://web.liferay.com/web/user.26526/blog/-/blogs/fixing-module-package-access-modifiers
thumbnail
6年前 に Sunit Chatterjee によって更新されました。

RE: Extending LDAPUserImporter ???

Junior Member 投稿: 28 参加年月日: 17/05/18 最新の投稿
Thanks a ton, David and Andrew.

I will try out both the suggestions (Exposing private packages and using Ext Plugins)

Sunit
thumbnail
6年前 に Andrew Jardine によって更新されました。

RE: Extending LDAPUserImporter ???

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
I had forgotten about this post! I was thinking about it, but I was actually thinking about another one -- the one you did with the message boards where there were 1000 caveats and things to track (well, not 1000, but a dozen anyway emoticon) so I wasn't sure that it was the best option.

But thanks for adding this link -- good refresher and I am not refactoring something to expose the Login Portlet constants to eliminate my hard coded portlet id.
thumbnail
6年前 に Sunit Chatterjee によって更新されました。

RE: Extending LDAPUserImporter ???

Junior Member 投稿: 28 参加年月日: 17/05/18 最新の投稿
Just want to give an update, that I was able to solve my use case with the approach of modifying the package export of OSGI bundles. It worked like a charm. Although I faced few hiccups, but they were more due to my inexperience with liferay and OSGI.

But it was a great learning experience for me, so thank you very much.

I think this will solve my other use case also where I need to extend Liferay's implementation of Elastic search - https://web.liferay.com/community/forums/-/message_boards/message/94275487

Thanks
Sunit