code: protected void deleteUser(CmsRequestContext context, CmsUser user, CmsUser replacement)
      throws CmsException, CmsSecurityException, CmsRoleViolationException {
  
          if (OpenCms.getDefaultUsers().isDefaultUser(user.getName())) {
              throw new CmsSecurityException(
                  org.opencms.security.Messages.get().container(
                      org.opencms.security.Messages.ERR_CANT_DELETE_DEFAULT_USER_1,
                      user.getName()));
          }
          if (context.getCurrentUser().equals(user)) {
              throw new CmsSecurityException(Messages.get().container(Messages.ERR_USER_CANT_DELETE_ITSELF_USER_0));
          }
  
          CmsDbContext dbc = null;
          try {
              dbc = getDbContextForDeletePrincipal(context);
              CmsRole role = CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(user.getName()));
              checkRoleForUserModification(dbc, user.getName(), role);
              m_driverManager.deleteUser(
                  dbc,
                  dbc.getRequestContext().getCurrentProject(),
                  user.getName(),
                  null == replacement ? null : replacement.getName());
          } catch (Exception e) {
              CmsDbContext dbcForException = m_dbContextFactory.getDbContext(context);
              dbcForException.report(null, Messages.get().container(Messages.ERR_DELETE_USER_1, user.getName()), e);
              dbcForException.clear();
          } finally {
              if (null != dbc) {
                  dbc.clear();
              }
          }
      }
docs: Deletes a user, where all permissions and resources attributes of the user
  were transfered to a replacement user, if given.<p>
  
  @param context the current request context
  @param user the user to be deleted
  @param replacement the user to be transfered, can be <code>null</code>
  
  @throws CmsRoleViolationException if the current user does not own the rule {@link CmsRole#ACCOUNT_MANAGER}
  @throws CmsSecurityException in case the user is a default user
  @throws CmsException if something goes wrong