Message Boards

Overriding DefaultFullNameGenerator

thumbnail
Steve Weiss, modified 2 Years ago.

Overriding DefaultFullNameGenerator

Regular Member Posts: 107 Join Date: 9/20/11 Recent Posts

We are moving from Liferay 6.2 to 7.2, and in 6.2 we had a component that overrode the DefaultFullNameGenerator. It was configured in liferay-portal.ext thusly:

users.full.name.generator=gov.nasa.hq.liferay.portal.NasaPreferredNameGenerator

So now I have two questions (to start with):

1. Will this configuratin still work in 7.2?

2. In 6.2 the component was deployed as an ext plugin. I'd rather not do that in 7.2 so what would be the best approach. I think there's only one Java class so hopefully it will simple.

 

thumbnail
Olaf Kock, modified 2 Years ago.

RE: Overriding DefaultFullNameGenerator

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts

Check if the interface that your generator implements is still there, and is implemented by an OSGi Service. That should point you to a possible path. Note that the interface might have changed packages - there has been quite a lot of "repackaging" between 6.2 and 7.0, but it still should be recognizable.

If you check how it's currently implemented (e.g. how Liferay's default implementations are wired) you're one step closer to the solution.

thumbnail
Steve Weiss, modified 2 Years ago.

RE: RE: Overriding DefaultFullNameGenerator

Regular Member Posts: 107 Join Date: 9/20/11 Recent Posts

Thanks. As far as I can tell there doesn't seem to be an OSGI service involved. The class we're extending is in portal-kernel.jar:

    com/liferay/portal/kernel/security/auth/DefaultFullNameGenerator.class

There's configuration in security-spring.xml, which is in portal-impl.jar in the ROOT webapp:

<bean class="com.liferay.portal.kernel.security.auth.DefaultFullNameGenerator" id="com.liferay.portal.kernel.security.auth.DefaultFullNameGenerator" />

<bean class="com.liferay.portal.kernel.security.auth.FullNameGeneratorFactory" id="com.liferay.portal.kernel.security.auth.FullNameGeneratorFactory">
        <property name="fullNameGenerator" ref="com.liferay.portal.kernel.security.auth.DefaultFullNameGenerator" />

 

Basically what we need this to do is, after the user has logged in it hits our LDAP server and gets the user's preferred name, and updates what has been stored in Liferay.

 

thumbnail
Steve Weiss, modified 2 Years ago.

RE: Overriding DefaultFullNameGenerator (Answer)

Regular Member Posts: 107 Join Date: 9/20/11 Recent Posts

Turns out we can simply extend com.liferay.portal.kernel.security.auth.DefaultFullNameGenerator and override the getFullName method to do what we want.