Guest User

Untitled

a guest
Jun 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. protected void saveLastAuthInfo(ExecutionContext ctx,
  2. Map<String, String> params,
  3. Integer resourceId) throws Exception {
  4. if (params.containsKey(LAST_AUTH_VERSION) &&
  5. params.containsKey(LAST_AUTH_REPORTED_IP)) {
  6. /* записываем это всё в базу только в том случае,
  7. * когда что-то передается в параметрах
  8. * авторизации */
  9. ctx.getSession().executeUpdate("update RESOURCE set LAST_AUTH_DATE=now(), " +
  10. "LAST_AUTH_VERSION=:VERSION, " +
  11. "LAST_AUTH_REPORTED_IP=:REP_IP, " +
  12. "LAST_AUTH_CAPTURED_IP=:CAP_IP where ID=:ID",
  13. set(new StringParameterBinding("VERSION", getStringParam(params, LAST_AUTH_VERSION)),
  14. new StringParameterBinding("REP_IP", getStringParam(params, LAST_AUTH_REPORTED_IP)),
  15. new StringParameterBinding("CAP_IP", ctx.getCapturedIp()),
  16. new IntegerParameterBinding("ID", resourceId)));
  17. }
  18. }
Add Comment
Please, Sign In to add comment