getUserFields = async (req) => {
  const userTable = Table.findOne({ name: "users" });
  const userFields = userTable
    .getFields()
    .filter((f) => !f.calculated && f.name !== "id");
  //console.log("userFields:",userFields);
  const iterForm = async (cfgField) => {
    const signup_form_name = getState().getConfig(cfgField, "");
    if (signup_form_name) {
      const signup_form = await View.findOne({ name: signup_form_name });
      if (signup_form) {
        (signup_form.configuration.columns || []).forEach((f) => {
          const uf = userFields.find((uff) => uff.name === f.field_name);
          if (uf) {
            const fvObj = uf.type?.fieldviews?.[uf.fieldview];
            if (fvObj && !fvObj?.fieldview?.unsuitableAsAdminDefault) {
              uf.fieldview = f.fieldview;
              uf.attributes = { ...f.configuration, ...uf.attributes };
            }
          }
        });
      }
    }
  };
  await iterForm("signup_form");
  await iterForm("new_user_form");
  //console.log(userFields);
  for (const f of userFields) {
    if (f.is_fkey && !f.fieldview) {
      f.fieldviewObj = getState().keyFieldviews?.select;
      if (f.fieldviewObj) {
        f.input_type = "fromtype";
        f.fieldview = "select";
      }
    }
    await f.fill_fkey_options();
    if (f.name === "email") {
      f.validator = (s) => {
        if (!User.valid_email(s)) return req.__("Not a valid e-mail address");
      };
      f.attributes = {
        ...(f.attributes || {}),
        input_type: "email",
      };
    }
    if (f.name === "role_id") {
      f.fieldview = "role_select";
      await f.fill_fkey_options();
    }
  }
  return userFields;
}
@param {object} req
@returns {Promise<object>}