Entitlements Function Demo

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

This allows you to use an external permissioning or entitlment 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 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 a list of 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.

AdapTable Help Resources:

Generating dummy data, please wait ...