Skip to Content

Solution Patterns

Show dashboards by client group

Give each group of customers its own dashboard while each customer still sees only their rows.

Your app decides which dashboard a group gets. The guest token keeps each customer on their own rows. Databrain has no group field: clientId is always one customer.

Before you start

  • Each group has its own dashboard in the same data app.
  • Your app knows which group each customer is in.

Steps

  1. In your backend, find the signed-in user’s customer and its group.
  2. Pick the dashboard ID for that group, for example from a map in your code:
const dashboardByGroup = {
  north: 'NORTH_DASHBOARD_ID',
  south: 'SOUTH_DASHBOARD_ID',
};
  1. Create a guest token for the customer. Put only that group’s dashboard in allowedEmbeds:
{
  "clientId": "acme-corp",
  "dataAppName": "Customer Analytics",
  "params": {
    "allowedEmbeds": ["NORTH_DASHBOARD_ID"]
  }
}
  1. Render that dashboard with the token.

Each customer now opens only their group’s dashboard, with only their rows. A changed dashboard-id in the browser does not open another group’s dashboard.

If something goes wrong

  • The dashboard shows UNAUTHORIZED. The dashboard-id on the page is not in the token’s allowedEmbeds.
  • A customer with no group. Refuse in your backend. Do not fall back to a dashboard for everyone.

Related: Role-based dashboard filtering.