user2861190
user2861190

Reputation: 11

How to create a UserModelListener in liferay 6.2 CE which captures the data of user details updated only in Control panel-> User orgnizations

I am new to Liferay, I am using Liferay 6.2 CE and I am trying to create a ModelListener in my hooks to capture the data when any user is updated in the portal. I use below function

public void onBeforeUpdate(User user) 
{}

But this function is being triggered when a user logins into the portal and as well as when user details being updated into the control panel. I need the above function to capture the data only when the user is being updated in the control panel.

Upvotes: 0

Views: 50

Answers (1)

jorgediaz-lr
jorgediaz-lr

Reputation: 982

About the user update when an user logs in it is because Liferay updates login date in User table.

You can disable that functionality adding users.update.last.login=false to your portal-ext.properties ( more info see: https://docs.liferay.com/portal/6.2/propertiesdoc/portal.properties.html#Users )

If you don't want to disable that functionality, perhaps you can query the user from database and compare it with the new user object that you are receiving as a parameter:

  • In case both user objects from parameter and from database have the same information except for login information => you are in the login case
  • In case there are more differences between that user objects => you are in the updte from control panel case

Upvotes: 1

Related Questions