/** * Returns the complete user session info of a user from the session storage, * or <code>null</code> if this session id has no session info attached.<p> * * @param sessionId the OpenCms session id to return the session info for, * this must be a String representation of a {@link CmsUUID} * * @return the complete user session info of a user from the session storage * * @see #getSessionInfo(CmsUUID) */ public CmsSessionInfo getSessionInfo(String sessionId) { return getSessionInfo(getSessionUUID(sessionId)); }
/** * Updates all session info objects, so that invalid projects * are replaced by the Online project.<p> * * @param cms the cms context */ public void updateSessionInfos(CmsObject cms) { // get all sessions List<CmsSessionInfo> userSessions = getSessionInfos(); Iterator<CmsSessionInfo> i = userSessions.iterator(); while (i.hasNext()) { CmsSessionInfo sessionInfo = i.next(); // check is the project stored in this session is not existing anymore // if so, set it to the online project CmsUUID projectId = sessionInfo.getProject(); try { cms.readProject(projectId); } catch (CmsException e) { // the project does not longer exist, update the project information with the online project sessionInfo.setProject(CmsProject.ONLINE_PROJECT_ID); addSessionInfo(sessionInfo); } } }
/** * Adds a new session info into the session storage.<p> * * @param sessionInfo the session info to store for the id */ protected void addSessionInfo(CmsSessionInfo sessionInfo) { if (getUserSessionMode() == UserSessionMode.standard) { m_sessionStorageProvider.put(sessionInfo); } else if (getUserSessionMode() == UserSessionMode.single) { CmsUUID userId = sessionInfo.getUserId(); List<CmsSessionInfo> infos = getSessionInfos(userId); if (infos.isEmpty() || ((infos.size() == 1) && infos.get(0).getSessionId().equals(sessionInfo.getSessionId()))) { m_sessionStorageProvider.put(sessionInfo); } else { throw new RuntimeException("Can't create another session for the same user."); } } }
content += "Logged in users : " + sm.getSessionCountAuthenticated() + "\n"; content += "Currently active sessions: " + sm.getSessionCountCurrent() + "\n"; content += "Total created sessions : " + sm.getSessionCountTotal() + "\n\n\n";
CmsSessionInfo sessionInfo = OpenCms.getSessionManager().getSessionInfo(getSession()); if (sessionInfo == null) { return null; Buffer messageQueue = OpenCms.getSessionManager().getBroadcastQueue(sessionId); if (!messageQueue.isEmpty()) {
CmsSessionInfo sessionInfo = getSessionInfo(req); if (sessionInfo != null) { addSessionInfo(sessionInfo); } else { HttpSession session = req.getSession(false); addSessionInfo(sessionInfo);
/** * Returns the OpenCms user session info for the given http session, * or <code>null</code> if no user session is available.<p> * * @param session the current http session * * @return the OpenCms user session info for the given http session, or <code>null</code> if no user session is available */ public CmsSessionInfo getSessionInfo(HttpSession session) { if (session == null) { return null; } CmsUUID sessionId = (CmsUUID)session.getAttribute(CmsSessionInfo.ATTRIBUTE_SESSION_ID); return (sessionId == null) ? null : getSessionInfo(sessionId); }
CmsSessionInfo sessionInfo = getSessionInfo(event.getSession()); CmsUUID userId = null; if (sessionInfo != null) { if ((userId != null) && (getSessionInfos(userId).size() == 0)) {
CmsSessionInfo sessionInfo = getSessionInfo(req); if (sessionInfo != null) { addSessionInfo(sessionInfo); } else { HttpSession session = req.getSession(false); session.setAttribute(CLIENT_TOKEN, generateClientToken(req)); addSessionInfo(sessionInfo);
while (itUsers.hasNext()) { CmsUser user = itUsers.next(); if (OpenCms.getSessionManager().getSessionInfos(user.getId()).isEmpty()) { continue;
OpenCms.getSessionManager().checkCreateSessionForUser(user); getCmsObject().loginUser(userName, password, getRequestContext().getRemoteAddress()); OpenCms.getSessionManager().updateSessionInfo(getCmsObject(), getRequest()); OpenCms.getSessionManager().sendBroadcast(null, loginMessage.getMessage(), user);
/** * Commits the edited project to the db.<p> */ @Override public void actionCommit() { List<Throwable> errors = new ArrayList<Throwable>(); try { if (isForAll()) { OpenCms.getSessionManager().sendBroadcast(getCms(), m_msgInfo.getMsg()); } else { List<String> ids = CmsStringUtil.splitAsList(getParamSessionids(), CmsHtmlList.ITEM_SEPARATOR); Iterator<String> itIds = ids.iterator(); while (itIds.hasNext()) { String id = itIds.next(); OpenCms.getSessionManager().sendBroadcast(getCms(), m_msgInfo.getMsg(), id); } } } catch (Throwable t) { errors.add(t); } // set the list of errors to display when saving failed setCommitErrors(errors); }
context.getRemoteAddress())); OpenCms.getSessionManager().updateSessionInfo( currentCms, (HttpServletRequest)VaadinService.getCurrentRequest()); OpenCms.getSessionManager().sendBroadcast( null, storedMessage,
CmsSessionInfo sessionInfo = m_sessionManager.getSessionInfo(req); if (!getSessionManager().hasValidClientToken(req)) { if (LOG.isDebugEnabled()) { LOG.debug("Client token in session invalid.");
/** * @see org.opencms.workplace.tools.A_CmsHtmlIconButton#isVisible() */ @Override public boolean isVisible() { if (getItem() != null) { return !OpenCms.getSessionManager().getBroadcastQueue(getItem().getId()).isEmpty(); } return super.isVisible(); } };
/** * Initialize member variables.<p> */ protected void initMembers() { synchronized (LOCK) { m_resourceInitHandlers = new ArrayList<I_CmsResourceInit>(); m_requestHandlers = new HashMap<String, I_CmsRequestHandler>(); m_systemInfo = new CmsSystemInfo(); m_exportPoints = Collections.emptySet(); m_defaultUsers = new CmsDefaultUsers(); m_localeManager = new CmsLocaleManager(Locale.ENGLISH); m_sessionManager = new CmsSessionManager(); m_runtimeProperties = new Hashtable<Object, Object>(); // the default event manager must be available because the configuration already registers events m_eventManager = new CmsEventManager(); // default link manager is required for test cases m_linkManager = new CmsLinkManager(new CmsDefaultLinkSubstitutionHandler()); } }
request.getSession().getMaxInactiveInterval()); OpenCmsCore.getInstance().getSessionManager().addSessionInfo(sessionInfo);
LOG.info(Messages.get().getBundle().key( Messages.LOG_MM_SESSION_STAT_3, String.valueOf(sm.getSessionCountAuthenticated()), String.valueOf(sm.getSessionCountCurrent()), String.valueOf(sm.getSessionCountTotal())));
CmsSessionInfo sessionInfo = OpenCms.getSessionManager().getSessionInfo(getSession()); if (sessionInfo == null) { return null; Buffer messageQueue = OpenCms.getSessionManager().getBroadcastQueue(sessionId); if (!messageQueue.isEmpty()) {
CmsSessionInfo sessionInfo = getSessionInfo(session); if (sessionInfo != null) { addSessionInfo(sessionInfo); } else { sessionInfo = new CmsSessionInfo( addSessionInfo(sessionInfo);