Entitlements Function Demo

Another way to provide Entitlements in Predefined Config is via a Function (the EntitlementLookUpFunction property).

Note: you provide the name of function in Entitlements Predefined Config, but provide the actual function implementation in UserFunctions.

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 Function and it returns an AccessLevel.

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

In this example the function does 3 things:

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

Generating dummy data, please wait ...