Foros de discusión
Deactivate user automatically with reference to time spent in portal
ponraj s, modificado hace 11 años.
Deactivate user automatically with reference to time spent in portal
Junior Member Mensajes: 33 Fecha de incorporación: 12/10/11 Mensajes recientes
Hi friends. i have been working on a liferay portal which is basically an elearning concept. Here users can be created by self registration process and the registered users should have access over the portal for only 100 hours ie the time spent accessing the portal ,time been calculated from the difference of log in and log out time .After working 100 hours in the portal the user should be auto deactivated .This is my requirement .It will be more helpful if someone gives me an idea to achieve it .
Thanks and Regards ,
S.Ponraj
Thanks and Regards ,
S.Ponraj
Apoorva Prakash, modificado hace 11 años.
RE: Deactivate user automatically with reference to time spent in portal
Liferay Master Mensajes: 658 Fecha de incorporación: 15/06/10 Mensajes recientesponraj s:
Hi friends. i have been working on a liferay portal which is basically an elearning concept. Here users can be created by self registration process and the registered users should have access over the portal for only 100 hours ie the time spent accessing the portal ,time been calculated from the difference of log in and log out time .After working 100 hours in the portal the user should be auto deactivated .This is my requirement .It will be more helpful if someone gives me an idea to achieve it .
Thanks and Regards ,
S.Ponraj
Hello Ponraj,
You can achieve this with the following approach:
Create CustomLoginPreAction, CustomLoginPostAction and CustomLogoutPreAction. Now store the session start time in a Custom Attribute when user logs in, and calculate total time at logout time in CustomLogoutPreAction class and store them in some Custom Attributes accordingly. Now you can put a check in CustomLoginPreAction class for 100 hours condition and log him out as per your condition. There are some drawbacks of this approach:
- You cannot track each session because you are overwriting value every time
- If user leaved the session open (does not log out), time tracking will be continued.
HTH.
Thanks and Regards,
Apoorva Prakash
ponraj s, modificado hace 11 años.
RE: Deactivate user automatically with reference to time spent in portal
Junior Member Mensajes: 33 Fecha de incorporación: 12/10/11 Mensajes recientes
Thanks Apoorva Prakash for your reply .
i got your point of creating customloginaction .You mentioned two drawbacks First one we cannot track session why so i didn't understand and second one if a user doesn't logged out his session will be automatically closed so i don't think that second one will affect .Could you please explain me clearly about the first drawback .. and is there anyone alternative way to over the drawback.
Thanks and Regards,
S.Ponraj
i got your point of creating customloginaction .You mentioned two drawbacks First one we cannot track session why so i didn't understand and second one if a user doesn't logged out his session will be automatically closed so i don't think that second one will affect .Could you please explain me clearly about the first drawback .. and is there anyone alternative way to over the drawback.
Thanks and Regards,
S.Ponraj
Apoorva Prakash, modificado hace 11 años.
RE: Deactivate user automatically with reference to time spent in portal
Liferay Master Mensajes: 658 Fecha de incorporación: 15/06/10 Mensajes recientesponraj s:
Thanks Apoorva Prakash for your reply .
i got your point of creating customloginaction .You mentioned two drawbacks First one we cannot track session why so i didn't understand and second one if a user doesn't logged out his session will be automatically closed so i don't think that second one will affect .Could you please explain me clearly about the first drawback .. and is there anyone alternative way to over the drawback.
Thanks and Regards,
S.Ponraj
Hello Ponraj,
We cannot track each session details because we are summing up data every time, not storing details of each session. And in the second point, in case session timeout only the session will be deactivated, not the /c/portal/logout will be called, and without that your CustomLogoutPreAction will get executed.
HTH.
Thanks and Regards,
Apoorva Prakash
ponraj s, modificado hace 11 años.
RE: Deactivate user automatically with reference to time spent in portal
Junior Member Mensajes: 33 Fecha de incorporación: 12/10/11 Mensajes recientes
Thanks again i am cleared now ... will think of some different logic
Apoorva Prakash, modificado hace 11 años.
RE: Deactivate user automatically with reference to time spent in portal
Liferay Master Mensajes: 658 Fecha de incorporación: 15/06/10 Mensajes recientesponraj s:
Thanks again i am cleared now ... will think of some different logic
If you want data for session tracking, you can create a portlet with services and update their data from CustomLoginPostAction.
HTH.