Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: RE: Overriding DefaultFullNameGenerator
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.
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.
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.
Turns out we can simply extend com.liferay.portal.kernel.security.auth.DefaultFullNameGenerator and override the getFullName method to do what we want.
Powered by Liferay™