Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
Ponraj S
Deactivate user automatically with reference to time spent in portal
23 de abril de 2013 2:08
Respuesta

Ponraj S

Ranking: Junior Member

Mensajes: 33

Fecha de incorporación: 12 de octubre de 2011

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
Apoorva Prakash
RE: Deactivate user automatically with reference to time spent in portal
23 de abril de 2013 3:59
Respuesta

Apoorva Prakash

Ranking: Liferay Master

Mensajes: 659

Fecha de incorporación: 15 de junio de 2010

Mensajes recientes

ponraj 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
RE: Deactivate user automatically with reference to time spent in portal
23 de abril de 2013 22:59
Respuesta

Ponraj S

Ranking: Junior Member

Mensajes: 33

Fecha de incorporación: 12 de octubre de 2011

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
Apoorva Prakash
RE: Deactivate user automatically with reference to time spent in portal
23 de abril de 2013 23:31
Respuesta

Apoorva Prakash

Ranking: Liferay Master

Mensajes: 659

Fecha de incorporación: 15 de junio de 2010

Mensajes recientes

ponraj 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
RE: Deactivate user automatically with reference to time spent in portal
24 de abril de 2013 0:30
Respuesta

Ponraj S

Ranking: Junior Member

Mensajes: 33

Fecha de incorporación: 12 de octubre de 2011

Mensajes recientes

Thanks again i am cleared now ... will think of some different logic
Apoorva Prakash
RE: Deactivate user automatically with reference to time spent in portal
24 de abril de 2013 3:25
Respuesta

Apoorva Prakash

Ranking: Liferay Master

Mensajes: 659

Fecha de incorporación: 15 de junio de 2010

Mensajes recientes

ponraj 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.