code: public String actionSwitchUser() throws CmsException {
  
          try {
              CmsSessionManager sessionManager = OpenCms.getSessionManager();
              CmsUser user = getCms().readUser(new CmsUUID(getJsp().getRequest().getParameter("userid")));
              return sessionManager.switchUser(getCms(), getJsp().getRequest(), user);
          } catch (CmsException e) {
              String toolPath = getCurrentToolPath().substring(0, getCurrentToolPath().lastIndexOf("/"));
              getToolManager().setCurrentToolPath(this, toolPath);
              throw e;
          }
      }
docs: Calls the switch user method of the SessionManager.<p>
  
  @return the direct edit patch
  
  @throws CmsException if something goes wrong