code: private CmsDbContext getDbContextForDeletePrincipal(CmsRequestContext context) throws CmsDataAccessException {
  
          CmsProject currentProject = context.getCurrentProject();
          CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
          CmsUUID projectId = dbc.getProjectId();
          // principal modifications are allowed if the current project is not the online project
          if (currentProject.isOnlineProject()) {
              // this is needed because
              // I_CmsUserDriver#removeAccessControlEntriesForPrincipal(CmsDbContext, CmsProject, CmsProject, CmsUUID)
              // expects an offline project, if not, data will become inconsistent
  
              // if the current project is the online project, check if there is a valid offline project at all
              List<CmsProject> projects = m_driverManager.getProjectDriver(dbc).readProjects(dbc, "");
              for (CmsProject project : projects) {
                  if (!project.isOnlineProject()) {
                      try {
                          dbc.setProjectId(project.getUuid());
                          if (null != m_driverManager.readResource(dbc, "/", CmsResourceFilter.ALL)) {
                              // shallow clone the context with project adjusted
                              context = new CmsRequestContext(
                                  context.getCurrentUser(),
                                  project,
                                  context.getUri(),
                                  context.getRequestMatcher(),
                                  context.getSiteRoot(),
                                  context.isSecureRequest(),
                                  context.getLocale(),
                                  context.getEncoding(),
                                  context.getRemoteAddress(),
                                  context.getRequestTime(),
                                  context.getDirectoryTranslator(),
                                  context.getFileTranslator(),
                                  context.getOuFqn());
                              dbc = m_dbContextFactory.getDbContext(context);
                              projectId = dbc.getProjectId();
                              break;
                          }
                      } catch (Exception e) {
                          // ignore
                      }
                  }
              }
          }
          dbc.setProjectId(projectId);
          return dbc;
      }
docs: Determines a project where the deletion of a principal can be executed and sets it in the returned db context.<p>
  
  @param context the current request context
  
  @return the db context to use when deleting the principal.
  
  @throws CmsDataAccessException if determining a project that is suitable to delete the prinicipal fails.