๐Ÿ› ๏ธ
Developer docs
Start BuildingGuides
  • โœจGetting Started
  • ๐ŸŽ›๏ธSelf Hosted Config
  • โœ๏ธSSO Login
    • Saml Identity Provider (Idp)
    • Oidc Identity Provider (Idp)
  • ๐ŸŽž๏ธFramework Specific Guide
    • โš›๏ธReactjs
    • โš›๏ธNextjs
    • โš›๏ธVuejs
    • โš›๏ธAngular
    • โš›๏ธSvelte
    • โš›๏ธSolid
    • โš›๏ธVanilla JS
  • โ„น๏ธToken
  • ๐Ÿ›๏ธMulti-Tenant Access Control
  • Embed using iFrame (Not Recommended approach)
  • ๐Ÿ”‘License Key Validation for Self-Hosted App
  • Test
  • ๐Ÿ‘ฉโ€๐Ÿ’ปHelpers
    • โœณ๏ธToken Body
    • โœ…Options
      • Custom Fiscal Year filter setup in DataBrain
    • ๐Ÿˆ‚๏ธServer Event
    • Embed Functions
    • Override Language
    • โœˆ๏ธEmbedding Architecture
    • โœˆ๏ธLLM Architecture
    • โœจLLM Connectors
      • Open AI
      • Claude AI
      • Azure Open AI
      • Llama
      • Mixtral
    • ๐Ÿ†”Dashboard ID
    • ๐Ÿ†”Metric ID
    • ๐Ÿ†”API Token
    • ๐Ÿ†”End User Metric Creation
    • Embedding APIs
      • Sync Datasource
  • Metric App Filter
  • Dashboard App Filter
  • Chat Mode
    • Step 1: Create Datamart and Workspace
    • Step 2: Create Data App and Embed ID
  • โœจSolutions Alchemy
    • Dashboards for Client Groups
    • Dashboard for Multiple Clients
    • Embedding: Role based Dashboard Filtering
    • Localized Currency Symbols
    • Manage Metrics
Powered by GitBook
On this page
  1. Solutions Alchemy

Dashboards for Client Groups

Segmenting Dashboards based on user accounts/client groups.

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_id
client_group

1

Group A

2

Group B

3

Group C

4

Group A

5

Group B

6

Group C

7

Group A

8

Group B

9

Group C

10

Group A

Note: The above table is a representation of the client organization table maintained on your database.

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}" />`
    );
}

4. Display the Dashboard Based on clientโ€™s Group

When the client logs in, their client_group determines which dashboard is embedded.

// Assume clientGroup is determined at login based on the `client_id`
const clientGroup = "Group A"; // Example group

// Embeds the dashboard for the clientโ€™s group
document.getElementById('dashboard-container').innerHTML = embedDashboard(clientGroup);

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

PreviousStep 2: Create Data App and Embed IDNextDashboard for Multiple Clients

Last updated 3 months ago

โœจ