Fórum

Update user session after update

thumbnail
Kevin Gebel, modificado 12 Anos atrás.

Update user session after update

Junior Member Postagens: 80 Data de Entrada: 27/05/10 Postagens Recentes
Hello !

I am updating user's attributes in a portlet (name, surname, etc.). How can I refresh user's session to update the UI (username in dockbar, etc.) ?

Thanks,
Kevin
thumbnail
Thiago Leão Moreira, modificado 12 Anos atrás.

RE: Update user session after update

Liferay Legend Postagens: 1449 Data de Entrada: 10/10/07 Postagens Recentes
Hey Kevin,

Are your changes available in the database? I'm pretty sure that once you update the User object in the database Liferay will update the interface automagically.
thumbnail
Kevin Gebel, modificado 12 Anos atrás.

RE: Update user session after update

Junior Member Postagens: 80 Data de Entrada: 27/05/10 Postagens Recentes
Yes, database is updated correctly. But the dockbar is not up to date...
thumbnail
Thiago Leão Moreira, modificado 12 Anos atrás.

RE: Update user session after update

Liferay Legend Postagens: 1449 Data de Entrada: 10/10/07 Postagens Recentes
Which service/method are you using to update the user?
thumbnail
Kevin Gebel, modificado 12 Anos atrás.

RE: Update user session after update

Junior Member Postagens: 80 Data de Entrada: 27/05/10 Postagens Recentes
I use UserLocalServiceUtil.updateUser(liferayUser).
Fields are updated in the database.
thumbnail
Thiago Leão Moreira, modificado 12 Anos atrás.

RE: Update user session after update

Liferay Legend Postagens: 1449 Data de Entrada: 10/10/07 Postagens Recentes
Humm, try to use the UserLocalServiceUtil.updateUser(long, userId, .... ServiceContext serviceContext). I know that this method has a big list of parameters but this is the right method to call when updating an user.
thumbnail
Sandeep Nair, modificado 12 Anos atrás.

RE: Update user session after update

Liferay Legend Postagens: 1744 Data de Entrada: 06/11/08 Postagens Recentes
Thats really strange. Even updateUser with just one argument should work properly. Can you please check/debug in UserPersistenceImpl.updateImpl(com.liferay.portal.model.User user, boolean merge)

I am not sure which finder is used in dock. But the caches are cleared and refilled in the method, whether it be argument with User or the multi argument method.

Regards,
Sandeep
thumbnail
Kevin Gebel, modificado 12 Anos atrás.

RE: Update user session after update

Junior Member Postagens: 80 Data de Entrada: 27/05/10 Postagens Recentes
I forgot to specify : if I refresh my page (F5), the dockbar is updated.