[ 
https://jira.duraspace.org/browse/DS-1376?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark H. Wood closed DS-1376.
----------------------------

       Resolution: Fixed
    Fix Version/s: 4.0

Thank you.  This has been addressed in DS-1085.
                
> Suggestion for update last_active database field on logon
> ---------------------------------------------------------
>
>                 Key: DS-1376
>                 URL: https://jira.duraspace.org/browse/DS-1376
>             Project: DSpace
>          Issue Type: Improvement
>          Components: DSpace API
>    Affects Versions: 3.0
>            Reporter: Onivaldo Rosa Junior
>              Labels: has-patch
>             Fix For: 4.0
>
>
> Suggestion for update last_active database field on logon
> Affect file AuthenticationManager.java (+ = add lines)
> + import java.util.Date;
> + import org.apache.log4j.Logger;
> + import org.dspace.authorize.AuthorizeException;
> public class AuthenticationManager
> {
>     /** List of authentication methods, highest precedence first. */
>     private static AuthenticationMethod methodStack[] =
>         
> (AuthenticationMethod[])PluginManager.getPluginSequence("authentication", 
> AuthenticationMethod.class);
> +    /** log4j logger */
> +    private static Logger log = Logger.getLogger(EPerson.class);
>     
>     /**
>      * Test credentials for authenticity.
> ....
> ....
>     private static int authenticateInternal(Context context,
>                             String username,
>                             String password,
>                             String realm,
>                             HttpServletRequest request,
>                             boolean implicitOnly)
>     {
>         // better is lowest, so start with the highest.
>         int bestRet = AuthenticationMethod.BAD_ARGS;
>         // return on first success, otherwise "best" outcome.
>         for (int i = 0; i < methodStack.length; ++i)
>         {
>             if (!implicitOnly || methodStack[i].isImplicit())
>             {
>                 int ret = 0;
>                 try
>                 {
>                     ret = methodStack[i].authenticate(context, username, 
> password, realm, request);
>                 }
>                 catch (SQLException e)
>                 {
>                     ret = AuthenticationMethod.NO_SUCH_USER;
>                 }
>                 if (ret == AuthenticationMethod.SUCCESS)
>                 {
> +                    EPerson me = context.getCurrentUser();
> +                    me.setLastActive(new Date());
> +                    try
> +                    {
> +                        me.update();
> +                    } catch (SQLException ex)
> +                    {
> +                        log.error("Could not update last-active timestamp", 
> ex);
> +                    } catch (AuthorizeException ex)
> +                    {
> +                        log.error("Could not update last-active timestamp", 
> ex);
> +                    }
>                     return ret;
>                 }                
>                 if (ret < bestRet)
>                 {
>                     bestRet = ret;
>                 }
>             }
>         }
>         return bestRet;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to