1.Client Table with Groups

Each client_id is associated with a client_group. Based on the group, they will be served a specific dashboard.
client_idclient_group
1Group A
2Group B
3Group C
4Group A
5Group B
6Group C
7Group A
8Group B
9Group C
10Group A

Implementation Outline:

  1. Master Dashboard: Create a Master Dashboard containing all metrics.
  2. Client Dashboards: For each client group, create separate dashboards that pull metrics from the Master Dashboard.
  3. Automatic Sync: Updates in the Master Dashboard reflect in all client dashboards using those metrics.
  4. Embedding: Embed each Client Group Dashboard to display only the relevant metrics per group.

2. Dashboard IDs by Client Group

Define IDs for each dashboard corresponding to the client groups.
const dashboardIds = {
  "Group A": "dashboard-id-a",
  "Group B": "dashboard-id-b",
  "Group C": "dashboard-id-c"
};

// Function to fetch dashboard ID based on client group
function getDashboardId(clientGroup) {
  return dashboardIds[clientGroup];
}

Generate Token

To obtain a guest token from DataBrain, utilize our REST API from your backend system.
POST: https://api.usedatabrain.com/api/v1/guest-token/create
Simple Request Body:
{
  "clientId": "id",
  "workspaceName": "workspacename"
}

3. Embedding the Dashboard

This function uses the fetched token and dashboard ID for the appropriate client group to embed the dashboard.
function embedDashboard(clientGroup, token) {
  const dashboardId = getDashboardId(clientGroup);
  return (
    `<dbn-dashboard token="${guest-token}" dashboard-id="${dashboardId}" />`
  );
}

Summary

This consolidated approach uses the client_id and client_group table to control access to specific dashboards. One token for all dashboards and you change the dashboard-id based on clientGroup.