docs: public static String getLoginTarget(CmsObject currentCms, CmsWorkplaceSettings settings, String requestedResource)
      throws CmsException {
  
          String directEditPath = CmsLoginHelper.getDirectEditPath(currentCms, settings.getUserSettings(), false);
          String target = "";
          boolean checkRole = false;
          String fragment = UI.getCurrent() != null ? UI.getCurrent().getPage().getUriFragment() : "";
          boolean workplace2 = false;
  
          if ((requestedResource == null) && (directEditPath != null)) {
              target = directEditPath;
          } else if ((requestedResource != null) && !CmsWorkplace.JSP_WORKPLACE_URI.equals(requestedResource)) {
              target = requestedResource;
          } else {
              workplace2 = true;
              target = CmsVaadinUtils.getWorkplaceLink();
              checkRole = true;
          }
  
          UserAgreementHelper userAgreementHelper = new UserAgreementHelper(currentCms, settings);
          boolean showUserAgreement = userAgreementHelper.isShowUserAgreement();
          if (showUserAgreement) {
              target = userAgreementHelper.getConfigurationVfsPath()
                  + "?"
                  + CmsLoginUserAgreement.PARAM_WPRES
                  + "="
                  + target;
          }
          if (checkRole && !OpenCms.getRoleManager().hasRole(currentCms, CmsRole.WORKPLACE_USER)) {
              workplace2 = false;
              target = CmsLoginHelper.getDirectEditPath(currentCms, settings.getUserSettings(), true);
              if (target == null) {
                  throw new CmsCustomLoginException(
                      org.opencms.workplace.Messages.get().container(
                          org.opencms.workplace.Messages.GUI_LOGIN_FAILED_NO_WORKPLACE_PERMISSIONS_0));
              }
          }
          if (!workplace2) {
              target = OpenCms.getLinkManager().substituteLink(currentCms, target);
          }
  
          if (workplace2 && CmsStringUtil.isEmptyOrWhitespaceOnly(fragment)) {
              if (settings.getUserSettings().getStartView().startsWith("/")) {
                  if (CmsWorkplace.VIEW_WORKPLACE.equals(settings.getUserSettings().getStartView())) {
                      fragment = CmsFileExplorerConfiguration.APP_ID;
                  } else if (CmsWorkplace.VIEW_ADMIN.equals(settings.getUserSettings().getStartView())) {
                      fragment = CmsAppHierarchyConfiguration.APP_ID;
                  }
              } else {
                  fragment = settings.getUserSettings().getStartView();
              }
          }
  
          if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(fragment)) {
              target += "#" + fragment;
          }
          return target;
      }