/** * Checks whether the given user has been inactive for longer than the configured limit.<p> * * If no max inactivity time is configured, always returns false. * * @param user the user to check * @return true if the user has been inactive for longer than the configured limit */ public boolean checkInactive(CmsUser user) { if (m_maxInactive == null) { return false; } try { long maxInactive = CmsStringUtil.parseDuration(m_maxInactive, Long.MAX_VALUE); return (System.currentTimeMillis() - user.getLastlogin()) > maxInactive; } catch (Exception e) { LOG.warn(e.getLocalizedMessage(), e); return false; } }
/** * Returns the last login.<p> * * Auxiliary Property for better representation.<p> * * @return the last login */ public String getLastlogin() { return LAST_LOGIN_FORMATTER.format(new Date(m_user.getLastlogin()), getLocale()); }
/** * Returns the last login time of the current user in localized format.<p> * * @return the last login time of the current user in localized format */ public String getLoginTime() { return getMessages().getDateTime(getSettings().getUser().getLastlogin()); }
/** * Returns the last login time of the current user in localized format.<p> * * @return the last login time of the current user in localized format */ public String getLoginTime() { return getMessages().getDateTime(getSettings().getUser().getLastlogin()); }
/** * Sets all needed data of the user into the list item object.<p> * * @param user the user to set the data for * @param item the list item object to set the data into */ protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_NAME, user.getFullName()); item.set(LIST_COLUMN_EMAIL, user.getEmail()); item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin())); }
Messages.get().getBundle(locale).key( Messages.GUI_USER_INFO_ONLINE_SINCE_1, DateFormat.getTimeInstance(DateFormat.DEFAULT, locale).format(new Date(user.getLastlogin())))).append( LINE_BREAK);
/** * Sets all needed data of the user into the list item object.<p> * * @param user the user to set the data for * @param item the list item object to set the data into */ protected void setUserData(CmsUser user, CmsListItem item) { item.set(LIST_COLUMN_LOGIN, user.getName()); item.set(LIST_COLUMN_DISPLAY, user.getSimpleName()); item.set(LIST_COLUMN_NAME, user.getFullName()); item.set(LIST_COLUMN_EMAIL, user.getEmail()); item.set(LIST_COLUMN_LASTLOGIN, new Date(user.getLastlogin())); item.set(LIST_COLUMN_ENABLED, new Boolean(user.isEnabled())); }
/** * @see org.opencms.db.I_CmsUserDriver#writeUser(org.opencms.db.CmsDbContext, org.opencms.file.CmsUser) */ public void writeUser(CmsDbContext dbc, CmsUser user) throws CmsDataAccessException { PreparedStatement stmt = null; Connection conn = null; try { conn = getSqlManager().getConnection(dbc); stmt = m_sqlManager.getPreparedStatement(conn, "C_USERS_WRITE_6"); // write data to database stmt.setString(1, m_sqlManager.validateEmpty(user.getFirstname())); stmt.setString(2, m_sqlManager.validateEmpty(user.getLastname())); stmt.setString(3, m_sqlManager.validateEmpty(user.getEmail())); stmt.setLong(4, user.getLastlogin()); stmt.setInt(5, user.getFlags()); stmt.setString(6, user.getId().toString()); stmt.executeUpdate(); } catch (SQLException e) { throw new CmsDbSqlException(Messages.get().container( Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)), e); } finally { m_sqlManager.closeAll(dbc, conn, stmt, null); } internalWriteUserInfos(dbc, user.getId(), user.getAdditionalInfo()); }
Query q = m_sqlManager.createQuery(dbc, C_USERS_WRITE_2); q.setParameter(1, Long.valueOf(user.getLastlogin())); q.setParameter(2, String.valueOf(user.getId().toString())); q.executeUpdate(); u.setUserLastName(m_sqlManager.validateEmpty(user.getLastname())); u.setUserEmail(m_sqlManager.validateEmpty(user.getEmail())); u.setUserLastLogin(user.getLastlogin()); u.setUserFlags(user.getFlags());
stmt = m_sqlManager.getPreparedStatement(conn, "C_USERS_WRITE_2"); stmt.setLong(1, user.getLastlogin()); stmt.setString(2, user.getId().toString()); stmt.executeUpdate(); stmt.setString(2, m_sqlManager.validateEmpty(user.getLastname())); stmt.setString(3, m_sqlManager.validateEmpty(user.getEmail())); stmt.setLong(4, user.getLastlogin()); stmt.setInt(5, user.getFlags()); stmt.setString(6, user.getId().toString());
return m_messages.getDateTime(m_cms.getRequestContext().getCurrentUser().getLastlogin());
return m_messages.getDateTime(m_cms.getRequestContext().currentUser().getLastlogin());