Onivaldo Rosa Junior created DS-1376:
----------------------------------------
Summary: 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
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
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel