cancel
Showing results for 
Search instead for 
Did you mean: 

Last login access time

biswajit
Champ in-the-making
Champ in-the-making
hi,
How can i display user's last login access time?
Please help me.
Thanks
6 REPLIES 6

zaizi
Champ in-the-making
Champ in-the-making
Turn on auditing: http://wiki.alfresco.com/wiki/Audit_Configuration

Look up the audit for last login. You can find example queries here: http://wiki.alfresco.com/wiki/Audit#Simple_audit_template_example.

NB: The audit queries might not work for your particular installation of Alfresco. But the ones on the wiki should get you started.

biswajit
Champ in-the-making
Champ in-the-making
Thank u for ur response but i want to display that last login information on alfresco toolbar or else somewhere in alfresco dashboard.tell me how this this is achieved in alfresco??
Thank u

jayjayecl
Confirmed Champ
Confirmed Champ
What kind of authentication protocol do you have ?
Basic Alfresco ? LDAP ?

biswajit
Champ in-the-making
Champ in-the-making
I have basic alfresco protocol

jayjayecl
Confirmed Champ
Confirmed Champ
I think the easiest way would be to create a custom aspect with 2 custom properties :


<property name="custom:personAspect_lastLoginDate">
         <type>d:date</type>
         </property>
<property name="custom:personAspect_thisLoginDate">
         <type>d:date</type>
         </property>

Then, you override java class AuthenticationComponentImpl adding custom code into the "authenticateImpl" method :


try
        {
            UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(userName,
                    new String(password));
            authenticationManager.authenticate(authentication);
           
       // your custom Code here : if person exists and has not the custom Aspect, add it
       // update the custom properties :
       // custom:personAspect_lastLoginDate = custom:personAspect_thisLoginDate
       // custom:personAspect_thisLoginDate = new Date;

            setCurrentUser(userName);

        }

Then you can modify any jsp if you decide to show this property.
For example, in the titlebar.jsp :

#{NavigationBean.currentUser.properties['customSmiley TongueersonAspect_lastLoginDate']};

biswajit
Champ in-the-making
Champ in-the-making
please tell me briefly beacuse i am new in alfresco.u kindly mention the total steps.