code: public static CmsWorkplaceSettings initSiteAndProject(CmsObject cms) {
  
          CmsWorkplaceSettings workplaceSettings = CmsWorkplace.initWorkplaceSettings(cms, null, false);
          String startSite = CmsWorkplace.getStartSiteRoot(cms, workplaceSettings);
          // switch to the preferred site
          workplaceSettings.setSite(startSite);
          cms.getRequestContext().setSiteRoot(startSite);
          // store the workplace settings
          CmsUserSettings settings = workplaceSettings.getUserSettings();
          // get the direct edit path
  
          try {
              CmsProject project = cms.readProject(settings.getStartProject());
              if (OpenCms.getOrgUnitManager().getAllAccessibleProjects(cms, project.getOuFqn(), false).contains(
                  project)) {
                  // user has access to the project, set this as current project
                  workplaceSettings.setProject(project.getUuid());
                  cms.getRequestContext().setCurrentProject(project);
              }
          } catch (CmsException e) {
              // unable to set the startup project, bad but not critical
              LOG.warn(
                  Messages.get().getBundle().key(
                      Messages.LOG_LOGIN_NO_STARTUP_PROJECT_2,
                      cms.getRequestContext().getCurrentUser().getName(),
                      settings.getStartProject()),
                  e);
          }
          return workplaceSettings;
      }
docs: Initializes the site and project for a CMS context after login, and returns the workplace settings for the corresponding user.<p>
  
  @param cms the CMS context which should be initialized
  @return the workplace set