If you want to embed a dashboard that has access to a multi-tenant dataset which requires row-level filtering, you can apply parameter filters to the dataset and override these parameters when requesting an embed token for a specific user in your application. This is useful if you would like to maintain one dataset for all your clients and make sure that each of them only has access to their relevant data.
In the video example below we specified a hierarchy array parameter "Customer" and applied it to the "Customer name" column in our "Sales Trends" dataset!
The different parameter types are explained in this Academy article, together with the specific filter expressions supporting these parameter types.
The parameter type also indicates how you should override the parameter in the authorization request:
An example of the complete embed token authorization request using our Node.js SDK can be found below:
(Notice that in this example we've specified a parameter override for the hierarchy array parameter Customer)
const Luzmo = require('@luzmo/nodejs-sdk');
var client = new Luzmo({
api_key: '< Your API key >',
api_token: '< Your API token >'
});
let promise = client.create('authorization', {
type: 'embed',
access: {
collections: [
{
id: '<collection ID>',
inheritRights: 'use'
}
]
},
username: '12345678',
suborganization: 'Burrito Co.',
name: 'Embed user',
email : 'embed_user@luzmo.com',
parameter_overrides: {
Customer: ['<Customer names visible to user 12345678>']
}
});
promise.then((result) => {
// result.id contains the embed authorization key,
// result.token contains the embed authorization token.
});
You might have noticed that parameters can also be created and used in filters in our dashboard editor: this actually helps you in getting a preview of how the dashboard would look like for your end user. You can easily prefilter your dashboard(s)/chart(s) which also improves the querying performance!
Do keep in mind that parameterized filters on the dashboard-level can be altered/removed by an embed user with modify access to the dashboard; o in case you are giving edit rights to your users, make sure to always put the filter on the dataset as well! Besides that, dashboard (parameter) filters are only applied when the dataset is queried within the dashboard's context; if you give at least "can use" access to your dataset(s) in the Embed authorization request, the Embed key-token pair can be used to query data via the Data API Service which would result in the dashboard (parameter) filters not being applied.