Entitlements Function Demo

Another way to provide UI Entitlements in Adaptable Options is via a JavaScript function (which also uses the moduleEntitlement property).

This allows you to use an external permissioning or entitlement server, or to do external lookups rather than provide a hard-coded list.

The function will be run each time an Entitlement is required. It receives the Id of the AdapTable instance, the current user and the Module in question, and it returns an AccessLevel.

If the function returns nothing, the Entitlement is given the default Access Level of 'Full' (this can be changed via the DefaultAccessLevel property, see Default Demo).

In this example the function does 3 things:

  • For Custom Sort and some editing-based Modules it returns an AccessLevel of Hidden (presumably it wants a non-editable grid).
  • For some other Modules it mimics a call to an external Permissions Service (which returns an AccessLevel of ReadOnly)
  • For all other AdapTable Modules it does nothing meaning that they will use the Entitlement set by the DefaultAccessLevel property.

Note: Entitlements are UI only - meaning any objects in the Module will still be applied if available in Adaptable State, or invoked by the Adaptable Api.

In this demo 'Custom Sort' is hidden (so it cannot be seen in any menu) but we provided a Custom Sort in Predefined Config for Contact column - sorting that column activates the Custom Sort.

AdapTable Help Resources:

Generating dummy data, please wait ...