If your data is separated in different schemas, or databases, you can override any data source properties in the embed authorization request to dynamically use different properties. You could even use this approach to apply overrides on a dataset granularity (this can be useful in cases where you have different tables per tenant)!
Depending on the specific data source, you can override different properties and you can find more information on this in our source-specific Making a "Your data source" Connection articles.
You can find the id of your database connection by navigating to the "Connections" page in the sidebar menu of your Luzmo account. From there, you can view all of your data connections, edit the connections settings, create new connections, and share existing connections -> Connections.
Below is an example of an authorization request that includes an account override for a Postgres Connection (to override the host, user, and password properties):
import Luzmo from '@luzmo/nodejs-sdk';
const client = new Luzmo({
api_key: '<your Luzmo API key>',
api_token: '<your Luzmo API token>',
host: 'https://api.luzmo.com:443'
});
const response = await client.create('authorization',
{
type: "embed",
username: "< A unique and immutable identifier for your user >",
name: "< user name >",
email: "< user email >",
suborganization: "< a suborganization name >",
access: {
collections: [
{
id: "<collection_id>",
inheritRights: "use"
}
]
},
account_overrides: {
<your connection_id>: {
host: "<The new database host URL to connect to>",
user: "<username>",
password: "<password>"
}
}
}
);
When you have multiple plugins, you can override the base_url in your embed authorization request to point Luzmo to where the queries of an integrated dashboard should be routed to. This allows you to switch between different plugins (e.g. a plugin in a specific region, a plugin that lives in the VPC of one of your clients, etc.).
Next to that, you can also override each of the custom authentication properties that you've set up when defining the plugin in Luzmo: this could be useful in case your plugin should be using different properties to connect to the data source!
The connection id of your plugin connection can also be found in the "Connections" page -> Connections.
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',
// Override the data connection
account_overrides: {
'< plugin_account_id >': {
base_url: '< The new plugin base url to connect to. >',
properties: {
'< custom property id >': '< new custom property value >'
}
}
}).then((result) => {
/* The temporary embed authorization key and token can be found in result.id and result.token, respectively. */
console.log(result);
});
Another use case for connection overrides (account_overrides) is when your database provides row-level security: row-level security in this context means that the database can automatically filter out rows based on the credentials. In case you are using one of our out-of-the-box connectors, you just specify the user/password overrides when requesting a embed authorization token for your user and your database will handle the rest! When using your own plugin, you should convert the X-Property-<custom_property_id> headers to user credentials used in your underlying database.
When using Warp and connection overrides together:
All details about the account_overrides properties can be found in our Developer documentation: Authorization resource properties.