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 optionalimplies, 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
type | Value | Meaning |
|---|---|---|
CapabilityType.Static | static | Permission to perform an operation, granted through roles |
CapabilityType.Boolean | boolean | An on/off permission controlled by entitlements |
CapabilityType.Numeric | numeric | A 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:
| Type | Includes |
|---|---|
AllCapabilityKey | All group paths and capability keys |
StaticCapabilityKey | Capability keys granted through roles, and the paths of groups containing those capabilities |
DynamicCapabilityKey | Capability 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 key | type | description.value |
|---|---|---|
user.view | CapabilityType.Static | View user profile |
user.create | CapabilityType.Static | Create user profile |
user.edit | CapabilityType.Static | Edit ticket |
user.delete_account | CapabilityType.Static | Delete user account |
ticket.view | CapabilityType.Static | View ticket |
ticket.create | CapabilityType.Static | Create ticket |
ticket.edit | CapabilityType.Static | Edit user profile |
ticket.delete | CapabilityType.Static | Delete ticket |
starter.download | CapabilityType.Boolean | Access Saavo Starter |
admin.user.manage | CapabilityType.Static | Manage all users |
admin.ticket.manage | CapabilityType.Static | Manage 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.