capability.ts

Capability tree structure, capability types, and template defaults.

config/capability.ts defines capabilities in a tree-shaped object of type WebsiteCapabilityRegistry. You can choose the keys at each level. The full path is the capability key, such as user.view or admin.user.manage. user, ticket, starter, and admin are example groups in the template, not fixed fields. You can reorganize the entire tree or export an empty object.

Configuration structure

Each value in the tree must have one of these two structures:

  • A group object containing another level of user-defined keys.
  • A capability definition containing type, description, and optional implies, with no child keys.

Group names are not fixed. The system joins keys at each level with periods to form full capability keys. Roles can also reference group paths. For example, referencing user expands to the capability keys beneath user.

Capability definitions

Prop

Type

typeValueMeaning
CapabilityType.StaticstaticPermission to perform an operation, granted through roles
CapabilityType.BooleanbooleanAn on/off permission controlled by entitlements
CapabilityType.NumericnumericA permission controlled by entitlements that can include a quota

Keys in implies should exist in the same capability configuration. The schema validates only the field format. If a key cannot be found, the system excludes it from the final capability set.

Generated types

The following types are generated from the configuration and contain no hard-coded keys:

TypeIncludes
AllCapabilityKeyAll group paths and capability keys
StaticCapabilityKeyCapability keys granted through roles, and the paths of groups containing those capabilities
DynamicCapabilityKeyCapability keys controlled by entitlements, and the paths of groups containing those capabilities

Template defaults

The table lists the capabilities defined in the template's default configuration. You can change both group names and capability keys.

Capability keytypedescription.value
user.viewCapabilityType.StaticView user profile
user.createCapabilityType.StaticCreate user profile
user.editCapabilityType.StaticEdit ticket
user.delete_accountCapabilityType.StaticDelete user account
ticket.viewCapabilityType.StaticView ticket
ticket.createCapabilityType.StaticCreate ticket
ticket.editCapabilityType.StaticEdit user profile
ticket.deleteCapabilityType.StaticDelete ticket
starter.downloadCapabilityType.BooleanAccess Saavo Starter
admin.user.manageCapabilityType.StaticManage all users
admin.ticket.manageCapabilityType.StaticManage all tickets

The current template has the English descriptions for user.edit and ticket.edit swapped. The table preserves the actual source values. The keys and their usage determine what these capabilities mean. You can correct these two display strings when customizing your project.

When changing capability keys or clearing the capability configuration, also update roles.ts, entitlements.ts, and any other code or data that references those keys.