[management] Add user email mapping account setting

Merged
ML
2d ago
+263-8

Describe your changes

Customers consuming streamed activity events and network traffic events get opaque user IDs and have to call the users API to resolve them. Resolving emails on our side exposes PII to the streaming destination, so it has to be an explicit admin opt-in.

This adds UserEmailMappingEnabled to ExtraSettings and user_email_mapping_enabled to AccountExtraSettings. Like the network traffic settings, OSS management does not persist it; the integrations layer owns storage and behavior (follow-up PRs for management streaming and the flow enricher). The API field is optional, so existing PUT /api/accounts/{id} clients keep working; when extra is sent without it, the setting is off.

It also fixes an existing reset: a PUT that omitted extra passed zeroed integration settings to UpdateExtraSettings, disabling network traffic logging. That call now only happens when extra is supplied, and the response carries the current integration values.

Issue ticket number and link

No issue yet.

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • I ran and tested this change locally — I did not rely on CI to find out whether it works
  • This PR has a single purpose (not a fix + refactor + feature in one)
  • This change is a trivial fix, OR it links an issue the NetBird team agreed on beforehand. Changes to the public API, gRPC protocols, functionality behavior, CLI / service flags, or new features always need that agreement first. See CONTRIBUTING.md.

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

The setting has no effect until the cloud integration PRs land; docs will ship with those.

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • New Features

    • Added an optional account setting to resolve user IDs to email addresses in streamed activity and network traffic events.
    • The setting can be read and updated through the account settings API.
  • Bug Fixes

    • Updating account settings without supplying extra settings now preserves existing integration settings, including email mapping.