docs: public void write(JsonWriter json, UserDto user, Collection<String> groups, @Nullable Collection<String> fields) {
      json.beginObject();
      json.prop(FIELD_LOGIN, user.getLogin());
      writeIfNeeded(json, user.getName(), FIELD_NAME, fields);
      if (userSession.isLoggedIn()) {
        writeIfNeeded(json, user.getEmail(), FIELD_EMAIL, fields);
        writeIfNeeded(json, user.isActive(), FIELD_ACTIVE, fields);
        writeIfNeeded(json, user.isLocal(), FIELD_LOCAL, fields);
        writeIfNeeded(json, user.getExternalLogin(), FIELD_EXTERNAL_IDENTITY, fields);
        writeIfNeeded(json, user.getExternalIdentityProvider(), FIELD_EXTERNAL_PROVIDER, fields);
        writeGroupsIfNeeded(json, groups, fields);
        writeScmAccountsIfNeeded(json, fields, user);
      }
      json.endObject();
    }