Kills all sessions for the given user.<p>

@param cms the current CMS context
@param user the user for whom the sessions should be killed

@throws CmsException if something goes wrong
483087
public void killSession(CmsObject cms, CmsUser user) throws CmsException {

        OpenCms.getRoleManager().checkRole(cms, CmsRole.ACCOUNT_MANAGER);
        List<CmsSessionInfo> infos = getSessionInfos(user.getId());
        for (CmsSessionInfo info : infos) {
            m_sessionStorageProvider.remove(info.getSessionId());
        }
    }
1204206
public static CmsLockActionRecord ensureLock(CmsObject cms, CmsResource resource) throws CmsException {

        LockChange change = LockChange.unchanged;
        List<CmsResource> blockingResources = cms.getBlockingLockedResources(resource);
        if ((blockingResources != null) && !blockingResources.isEmpty()) {
            throw new CmsException(
                Messages.get().container(
                    Messages.ERR_RESOURCE_HAS_BLOCKING_LOCKED_CHILDREN_1,
                    cms.getSitePath(resource)));
        }
        CmsUser user = cms.getRequestContext().getCurrentUser();
        CmsLock lock = cms.getLock(resource);
        if (!lock.isOwnedBy(user)) {
            cms.lockResourceTemporary(resource);
            change = LockChange.locked;
            lock = cms.getLock(resource);
        } else if (!lock.isOwnedInProjectBy(user, cms.getRequestContext().getCurrentProject())) {
            cms.changeLock(resource);
            change = LockChange.changed;
            lock = cms.getLock(resource);
        }
        return new CmsLockActionRecord(lock, change);
    }
855830
protected CmsObject registerSession(HttpServletRequest request, CmsObject cms) throws CmsException {

        if (!cms.getRequestContext().getCurrentUser().isGuestUser()) {
            // make sure we have a new session after login for security reasons
            HttpSession session = request.getSession(false);
            if (session != null) {
                session.invalidate();
            }
            session = request.getSession(true);
        }

        // update the request context
        cms = OpenCmsCore.getInstance().updateContext(request, cms);

        CmsUser user = cms.getRequestContext().getCurrentUser();
        if (!user.isGuestUser() && !OpenCms.getDefaultUsers().isUserExport(user.getName())) {
            // create the session info object, only for 'real' users
            CmsSessionInfo sessionInfo = new CmsSessionInfo(
                cms.getRequestContext(),
                new CmsUUID(),
                request.getSession().getMaxInactiveInterval());
            // register the updated cms object in the session manager
            OpenCmsCore.getInstance().getSessionManager().addSessionInfo(sessionInfo);
        }
        // return the updated cms object
        return cms;
    }
279454
public void removeResourceFromUsersPubList(CmsObject cms, Collection<CmsUUID> structureIds) throws CmsException {

        m_securityManager.removeResourceFromUsersPubList(cms.getRequestContext(), structureIds);
    }
95870
public Set<CmsUser> readResponsibleUsers(CmsResource resource) throws CmsException {

        return m_securityManager.readResponsibleUsers(m_context, resource);
    }
396202
private void setClipboardData(CmsSitemapClipboardData clipboardData) throws CmsException {

        CmsObject cms = getCmsObject();
        CmsUser user = cms.getRequestContext().getCurrentUser();
        if (clipboardData != null) {
            JSONArray modified = new JSONArray();
            if (clipboardData.getModifications() != null) {
                for (CmsUUID id : clipboardData.getModifications().keySet()) {
                    if (id != null) {
                        modified.put(id.toString());
                    }
                }
            }
            user.setAdditionalInfo(ADDINFO_ADE_MODIFIED_LIST, modified.toString());
            JSONArray deleted = new JSONArray();
            if (clipboardData.getDeletions() != null) {
                for (CmsUUID id : clipboardData.getDeletions().keySet()) {
                    if (id != null) {
                        deleted.put(id.toString());
                    }
                }
            }
            user.setAdditionalInfo(ADDINFO_ADE_DELETED_LIST, deleted.toString());
            cms.writeUser(user);
        }
    }
965351
public static void showUserInfo(CmsSessionInfo session) {

        final Window window = CmsBasicDialog.prepareWindow(DialogWidth.wide);
        CmsUserInfoDialog dialog = new CmsUserInfoDialog(session, new Runnable() {

            public void run() {

                window.close();
            }

        });
        window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_MESSAGES_SHOW_USER_0));
        window.setContent(dialog);
        A_CmsUI.get().addWindow(window);
    }
845478
protected void ensureLock() throws CmsException {

        CmsLock lock = m_cms.getLock(m_resource);
        if (lock.isUnlocked() || !lock.isLockableBy(m_cms.getRequestContext().getCurrentUser())) {
            m_cms.lockResourceTemporary(m_cms.getSitePath(m_resource));
            m_needToUnlock = true;
        }
    }
1318923
public CmsUgcSession createSession(CmsObject cms, HttpServletRequest request, CmsUgcConfiguration config)
    throws CmsUgcException {

        CmsUgcSession session = createSession(cms, config);
        HttpSession httpSession = request.getSession(true);
        httpSession.setAttribute("" + session.getId(), session);
        return session;
    }
222683
public void markResourceAsVisitedBy(CmsObject cms, String resourcePath, CmsUser user) throws CmsException {

        CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL);
        markResourceAsVisitedBy(cms, resource, user);
    }
898293
public static void setUser(Object user)
    {
        HttpSession session = WebContextFactory.get().getSession(true);
        session.setAttribute(USER, user);
    }
649412
private boolean isAllowedUser(CmsUser user) throws CmsException {

        if (user.getOuFqn().startsWith(m_cms.getRequestContext().getOuFqn())) {
            return true;
        }
        return OpenCms.getRoleManager().getRolesOfUser(m_cms, user.getName(), m_ou, true, true, false).size() > 0;
    }
24068
public long countUsers(CmsObject cms, CmsUserSearchParameters params) throws CmsException {

        return m_securityManager.countUsers(cms.getRequestContext(), params);
    }
681022
private function killUserSessions($user)
    {
        $sql = <<<SQL
SELECT
    s.sid,
    s.serial#
FROM
    gv\$session s,
    gv\$process p
WHERE
    s.username = ?
    AND p.addr(+) = s.paddr
SQL;

        $activeUserSessions = $this->_conn->fetchAll($sql, [strtoupper($user)]);

        foreach ($activeUserSessions as $activeUserSession) {
            $activeUserSession = array_change_key_case($activeUserSession, CASE_LOWER);

            $this->_execSql(
                sprintf(
                    "ALTER SYSTEM KILL SESSION '%s, %s' IMMEDIATE",
                    $activeUserSession['sid'],
                    $activeUserSession['serial#']
                )
            );
        }
    }
400224
public List<CmsUser> searchUsers(CmsRequestContext requestContext, CmsUserSearchParameters searchParams)
    throws CmsException {

        CmsDbContext dbc = m_dbContextFactory.getDbContext(requestContext);
        try {
            return m_driverManager.searchUsers(dbc, searchParams);
        } catch (Exception e) {
            dbc.report(null, Messages.get().container(Messages.ERR_SEARCH_USERS_0), e);
            return null;
        } finally {
            dbc.clear();
        }
    }
1192390
protected List<CmsUser> getUsers() throws CmsException {

        return CmsPrincipal.filterCoreUsers(OpenCms.getOrgUnitManager().getUsers(getCms(), "", true));
    }
749406
public void unsubscribeResourceForAll(CmsObject cms, CmsResource resource) throws CmsException {

        if (!isEnabled()) {
            throw new CmsRuntimeException(Messages.get().container(Messages.ERR_SUBSCRIPTION_MANAGER_DISABLED_0));
        }
        m_securityManager.unsubscribeResourceForAll(cms.getRequestContext(), getPoolName(), resource);
    }