Design Hub developer guide - company support plugins¶
Design Hub's company supports plugins are a collection of API endpoints that facilitate integrating the application into an organization's project management, authorization and enterprise resource planning systems. As such it handles concepts other than the rest of the plugin types.
A company plugin is a NodeJS module, stored in a folder set by Design Hub's configuration file (servicesDirectory).
NodeJS module API¶
Company support plugins are NodeJS modules, denoted by their filename: *.company.js and location in the services directory as configured during installation.
A company support plugin exports the following properties:
| Name | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Unique identifier of the plugin, used by Design Hub for identification and internal communication. If multiple plugins use the same identifier, the last one to be loaded overrides the others. |
label |
string | yes | Human readable name of the plugin, used by Design Hub to display GUI elements related to this plugin. |
getProjects |
async function | no | Called automatically during initialization and then on a predefined daily schedule to obtain an overall list of projects to be used by the application. Arguments: none Return value: Promise of array of objects. Each object corresponds to a project. The objects in the array should contain name and label attributes for a project. Label will be used on the GUI. |
getUserProjects |
async function | no | Called automatically during the successful authentication of a user, to obtain project assignments. The function must return a Promise of the results. The results are stored in the application database and used for authorization. Arguments: user (object) A javascript object describing the calling userthis includes domain for the current callReturn value: Promise of array of objects. Each object corresponds to a project. The objects in the array should contain name and label attributes for a project. |
getUserGroups |
async function | no | Called automatically during the successful authentication of a user, to obtain group memberships. The function must return a Promise of the results. The results are stored in the application database and used for authorization. Arguments: user (object) A javascript object describing the calling userthis includes domain for the current callReturn value: Promise of array of string. Each string corresponds to a group's name. |
domains |
array of strings | yes | List of domains where this plugin may be used, when authentication is enabled in Design Hub. Use * to allow any domain. |
onConfigurationChanged |
function | no | A callback function that Design Hub calls during initialization and whenever an administrator updates the Secrets of the system. Arguments: config (Object) An object with secrets attribute containing the key-value pairs of secrets from the Admin interface |
Plugin Skeleton¶
skeleton.company.js