Laliwala IT Services

Laliwala IT Services
Website Development

Sunday, February 20, 2011

User logout time




































































































































































































































































































A Gupta : I am trying to get the time when user logout. I have looked at the PortletSession and LogoutPostAction java files but have not got any useful solution.
     
    Would be great if anyone can tell a way of getting the last logout time of the user? I will really appreciate a quick response.
     
    Thanks in advance.
     
Sandeep Nair : Right now there is no column named logout time for user in liferay db. Having said that i think you can achieve the same using custom attribute to create an additionol column named logout time for user and hooking the same in your custom LogoutPostAction class .
     
    Regards,
     
    Sandeep
     
A Gupta : Thanks Sandeep. I will try it.
     
Arvind Mishra : Anshul
     
    do you need LastLogoutTime or all the logouts time for a user , kind of transactional data.
     
    If you want transactional data , then you need to update the table everytime user logs out.
     
    Thanks
     
    Arvind
     
A Gupta : Hi Arvind,
     
    I need only the last logout time of the user. So, every time user logs in and logs out, the table would be updated.
     
    Thanks
     
    Anshul Gupta
     
Mazhar Anwar : Hi Anshul,
     
    What about if User does not logged out manually, that is in case of session expired after session time-out?
     
    How can you update the table on user logout?
     
    Regards,
     
    Mazhar
     
A Gupta : Mazhar,
     
    You can actually check if user session is expired or not and if yes, then update the logout time. I have not implemented it but as soon as I do it, I will post some snippet.
     
Sandeep Nair : Yeah, thats not a tough thing to do, coz you just need a listener which implements HttpSessionListener in that case i guess and implement sessionDestroyed method as you want.
     
    Regards,
    Sandeep
     
R charan : One think what you said is ok having an custom attribute and filling it when LogOutPostAction is performed.
     
    For the case when session expires , (Correct me if iam wrong)
     
    -> Does LogoutPostAction class is called when session expires, if called then no problem the logout time will be recorded.
     
    -> If not .. we need to write a listener class which implements HttpSessionListener where we can record the time

1 comment: