Default Entitlement

View as Markdown

Summary

  • By default every Module has an AccessLevel of Full (unless overridden)
  • The one exception is the StateManagement (Manage State) Module, which is Hidden by default and must be entitled explicitly — setting defaultAccessLevel to Full does not unhide it
  • This default AccessLevel can be changed by developers using either a hard-coded value or a function

Developers can set the Default Access Level for Module Entitlements in AdapTable.

This is the Entitlement AccessLevel that will be used if not overridden through explicitly-set Module Entitlements.

The Default Entitlement can be one of 3 values:

  • ReadOnly
  • Hidden
  • Full

The property is set using the defaultAccessLevel property in Entitlement Options and it offers 2 ways to provide Entitlements:

  • Hard Coded Value - an explicitly provided Default AccessLevel
  • Function - a Default AccessLevel returned from a custom function

defaultAccessLevel

Default: Full
Set the default AccessLevel to use for Entitlements

Caution

  • If this property is not provided, most Modules default to Full
  • State Management defaults to Hidden and stays Hidden unless it is listed in moduleEntitlements
  • Setting defaultAccessLevel to Full does not unhide State Management

Hard Coded Value

This is a value that is set once at design time and doesn't require any run-time evaluation.

Entitlements: Default Access Level
Fork
  • In this example we set the Default Entitlement to Hidden, so most Modules are not available
  • We override Layout and FormatColumn to be ReadOnly - so users can see the Format Columns and can switch between Layouts - but not edit them
  • We override SettingsPanel and Dashboard to Full - so they are fully viewable and usable

See how the Default Entitlement is provided

Loading demo…

JavaScript Function

The other way to set the Default Access Level is via a Function.

This receives a DefaultAccessLevelContext object (which contains the username and the adaptableId of the current instance) and returns an AccessLevel.

This allows you to provide a different Default Access Level depending on the User's role.

// Set default Module Entitlement as 'Full' for Admins and 'ReadOnly' for everyone else
const adaptableOptions: AdaptableOptions = {
  entitlementOptions: {
    defaultAccessLevel: (accessLevelContext: DefaultAccessLevelContext) => {
      return mockEntitlementService.isAdmin(accessLevelContext.userName) ? 'Full' : 'ReadOnly';
    },
  },
};

Hint

If defaultAccessLevel is set to Hidden, make sure to enable the Settings Panel for access to AdapTable functionality