Entitlements Options

Options for managing Entitlements in AdapTable.

Each Module has 3 potential AccessLevel values:

  • Full - Fully visible and editable

  • Hidden - Completely hidden from the user - does not appear in any menus, toolbars, tool panels etc.

  • ReadOnly - Visible allowing users to access items provided in Predefined Configuration (e.g. Conditional Style or Export) but not to create their own

Entitlements Options Properties

Entitlements Options contains just 2 properties:

PropertyDescriptionDefault
defaultAccessLevelAccessLevel to use when an Entitlement is not explicitly set'Full'
moduleEntitlementsReturns either collection of Entitlement objects, or a Module to invoke when an Entitlement is required

Default Access Level

By default every Module has the Entitlement of Full

If this is not the required behaviour then setting defaultAccessLevel to 'Hidden' will automatically remove all Modules, and then only those explicity permissioned (in moduleEntitlements) will be available.

tip

If defaultAccessLevel is set to 'Hidden', make sure to enable the Dashboard for access to Toolbars

Module Entitlements

The moduleEntitlements property offers 2 ways to provide Entitlements:

moduleEntitlements?:
| Entitlement[]
| ((module: AdaptableModule, userName: string, adaptableId: string) => AccessLevel | undefined);

Entitlements List

This provides a collection of Entitlement objects, each of which is defined as follows:

PropertyDescription
accessLevelAccess Level for an Entitlement; options are: 'Full', ''ReadOnly', 'Hidden'
adaptableModuleName of Adaptable Module that has the Entitlement applied
export default {
// Set 2 ReadOnly Entitlements: Export and Layout.
// Users can access existing layouts & reports but not add / edit / delete their own
// Set 2 Hidden Entitlements: Percent Bar and Query.
// These Module wont be available in menus, Toolbars or Tool Panels
const adaptableOptions: AdaptableOptions = {
entitlementOptions: {
moduleEntitlements: [
{
adaptableModule: 'Export',
accessLevel: 'ReadOnly',
},
{
adaptableModule: 'Layout',
accessLevel: 'ReadOnly',
},
{
adaptableModule: 'PercentBar',
accessLevel: 'Hidden',
},
{
adaptableModule: 'Query',
accessLevel: 'Hidden',
},
]
},
};

Using Custom Function

An alternative to a list of Entitlements is to provide a custom function implementation.

note

This function will be invoked each time an Entitlement is checked returing the apppropriate Access Level

tip

You can use this function to query permissions stored remotely and which might update in real time

// Call a permission service on External Server to get Entitlements
const adaptableOptions: AdaptableOptions = {
entitlementOptions: {
moduleEntitlements: (
adaptableModule: Module, userName: string, adaptableId: string) => {
return callPermissionService(adaptableModule, userName, adaptableId);
},
};

Additional Rules

Some AdapTable Modules require additional conditions for it to be available in addition to setting the Entitlement.

These are usually supplied in Predefined Config or Adaptable Options. These include:

  • Team Sharing: the enableTeamSharing property must be set to true in TeamSharingOptions

  • glue42: the glue42 Predefined Config must contain the glue42 object

  • ipushpull: the ipushpull Predefined Config must contain the ipushpull object

Entitlements Scope

Entitlements work at the UI Level only.

This means that AdapTable will ensure that end users cannot see or access - throughout the AdapTable UI - elements like menus, toolbars, popups etc. in Functions to which they are not entitled.

However the Adaptable Api does not take notice of Entitlements, so anything that is managed programatically through code will ignore the User's entitlements.

tip

To ensure that the Adaptable Api is not called for functions to which the user has no access, use the getEntitlementAccessLevelForModule in Grid Api

if (gridApi.getEntitlementAccessLevelForModule('Layout')=='Full'){
layoutApi.doSomething....
}

Overriding Entitlements

Sometimes the Module level restriction of Entitlements is insufficient; e.g. a use case requires a Module to have a 'Full' entitlement (i.e. it's editable) but one particular object must be ReadOnly (i.e. cannot be deleted).

The IsReadOnly property of AdaptableObject is designed for precisely this reason, and it will overrride the 'Full' Entitlement in the Adaptable Module.

warning

There is no property for the opposite use case - where the Module's Entitlement is 'ReadOnly' but one AdaptTable object should be 'Full'

See Adaptable Objects for more.

More Information