netbirdio / dashboard

NetBird Management Service Web UI Panel

Home Page:https://app.netbird.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update the /Activity view to use email addresses from the /api/events response

mlsmaycon opened this issue · comments

Currently, our dashboard is mapping all the initiator_id and target_id that belong to users with email addresses from the GET /api/users response information to provide a better view of the activity logs.

With the new API version, the /api/events endpoint will provide the emails as part of its response, so we don't need to map things from the user's API.

These two fields were added:

  • initiator_email: can be used to in place of initiator_id when an event is initiated by an user
  • meta.email: can be used in place of target_id when an event affects a user

Here is an example of the new API response for a user event:

[
   {
      "activity":"User deleted",
      "activity_code":"user.delete",
      "id":"5",
      "initiator_email":"admin-user@gmail.com",
      "initiator_id":"auth0|65043ae22222",
      "meta":{
         "email":"regular-user@gmail.com"
      },
      "target_id":"auth0|65043ae65418a",
      "timestamp":"2023-09-15T11:08:35.304072136Z"
   },
]

When these fields are empty or null (meta.email case), we can assume that the API server doesn't have IDP integration configured, and we don't need to replace the initiator_id or target_id values with email addresses.