A Plugin is a small RESTful API that acts as an adapter between Luzmo and a source system. Within a plugin you can apply extra business rules. Instead of sending a query to a database, Luzmo will send a POST HTTP request to the plugin's /query endpoint. A plugin can be used for both user context filtering (i.e. only returning certain rows based on user context) and internal brokering (i.e. send request to a specific data source based on user context).

Specifically for plugins, there is a property called metadata which you can provide when requesting an embed authorization token. You will use this property to pass information from your backend to your plugin. When Luzmo launches the query to your plugin, you will be able to use the information that you have provided in the user.metadata property to decide how to handle the request for data.
For example, you could use it to provide the plugin with the client id of the client that has requested the dashboard. You could then translate this to a filter (user context filtering) or address a specific data source (brokering).

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',
  // Specify user specific data in the metadata property
  metadata: {
    clientId: 'Fiesty Fiesta',
    apiToken: '1kj123l10i2'
  }
}).then((result) => {
  /* The temporary embed authorization key and token can be found in result.id and result.token, respectively. */
  console.log(result);
});

This is one of the most powerful approaches: you can specify any custom logic that is needed to provide the correct data to the user that is looking at the dashboard! We have an Academy course on creating a basic plugin which is a great starting point, more detailed information can be found in our Developer Documentation.

Previous
Next

Need more information?

Do you still have questions? Let us know how we can help.
Send us feedback!

Course Outline