Permission-Capability/CapabilitySet mapping algorithm
Summary
Eureka uses Capabilities and CapabilitySets instead of assigning legacy FOLIO permission strings directly to users.
During module installation or upgrade, permissions from module descriptors are converted automatically:
Legacy concept | Eureka concept | Short explanation |
|---|---|---|
Permission | Capability | A single permission-like grant, such as viewing a user record or editing a budget. |
Permission with | CapabilitySet | A bundle of related Capabilities. |
User permissions | Roles with Capabilities / CapabilitySets | Users receive roles; roles contain the converted grants. |
The conversion is based mostly on the permission name. For example, users.item.get is interpreted as permission to view the Users Item resource.
The most important rule for new work is simple: new permissions must follow the naming convention. Do not rely on legacy exception mappings.
Key Terms
Term | Meaning |
|---|---|
Permission | The legacy FOLIO permission string, for example, |
Capability | The Eureka representation of one access grant. It has a resource, action, type, and optional backend endpoints. |
CapabilitySet | A group of Capabilities. It is created from a legacy permission that contains |
Resource | The thing access is being granted to, such as |
Action | What the user can do with the resource: |
Type | The broad category of the Capability: |
Endpoint | A backend path and HTTP method protected by the Capability, such as |
Conversion in Plain Language
When a module is installed or upgraded, mgr-tenant-entitlements publishes permission information from module descriptors. mod-roles-keycloak consumes that information and converts it.
The conversion has four main steps:
Step | What happens | Example |
|---|---|---|
1 | Split the permission name into dot-separated parts. |
|
2 | Decide the Capability type. | Is this data access, settings access, or a procedural operation? |
3 | Decide the Capability action. |
|
4 | Build the resource and Capability name. |
|
For permissions with subPermissions, the same conversion is also applied to each sub-permission, and the parent permission becomes a CapabilitySet.
Expected Permission Name Shape
Most permissions should follow this shape:
Position | Meaning | Example value |
|---|---|---|
First part | Module or application area |
|
Middle parts | Resource or sub-resource |
|
Optional scope | Whether the resource is one item or a collection |
|
Final part | Action word |
|
Examples of good permission names:
Permission | Why is it good |
|---|---|
| Clear resource ( |
| Clear collection-level access. |
| Clear single-record edit operation. |
| Clear UI resource and action. |
| Clear settings permission. Settings permissions may omit an action. |
Avoid permission names where the action is missing, unclear, or appears in the middle of the name, followed by extra details.
Action Conversion Rules
The converter normalizes many legacy action words into six Eureka actions.
Eureka action | Legacy action words that map to it |
|---|---|
view |
|
create |
|
edit |
|
delete |
|
manage |
|
execute | Used for procedural operations, such as export, approve, run, generate, reset, import, cancel, or execute. |
Important notes:
Situation | Result |
|---|---|
A data or settings permission ends with | The Capability action is |
A data or settings permission ends with | The Capability action is usually |
A data or settings permission ends with | The Capability action is |
A permission ends with | The Capability action is |
A procedural permission is detected. | The Capability action is always |
No valid action can be identified. | The permission cannot be converted and should be fixed in the module descriptor. |
Type Detection Rules
Each converted Capability has one of three types: data, settings, or procedural.
The current rules are based on PermissionUtils.java in folio-permission-utils.
Data Capabilities
Data Capabilities are for access to records or record collections.
The converter treats a permission as data access when:
Rule | Example |
|---|---|
No stronger settings or procedural rules apply. |
|
The permission contains |
|
The permission ends with |
|
The permission ends with |
|
The explicit data suffixes are .item.post and .collection.post. This matters because post can also be a procedural keyword; these suffixes prevent common create-record permissions from being classified as procedural operations.
Settings Capabilities
Settings Capabilities are for configuration areas.
The converter treats a permission as settings access when the permission name starts with or contains either of these keywords:
Settings keyword |
|---|
|
|
Examples:
Permission | Result |
|---|---|
| Settings Capability, action defaults to |
| Settings Capability. |
If a settings permission does not end with a recognized action word, it defaults to view.
Procedural Capabilities
Procedural Capabilities represent operations rather than regular record access. Examples include exporting data, approving an order, generating a report, or resetting something.
The converter uses these procedural keywords:
Procedural keywords |
|---|
|
A permission is usually considered procedural when it ends with one of these keywords and does not contain a data keyword such as item, collection, or items.
Examples:
Permission | Why is it procedural |
|---|---|
| Ends with |
| Contains a procedural operation: |
| Ends with |
| Ends with |
Procedural Capabilities always use the action execute.
Resource Name Rules
The resource name is the human-readable name derived from the permission.
Input rule | Output rule |
|---|---|
Dot-separated permission parts are joined with spaces. |
|
Hyphens inside a part are preserved. |
|
Underscores are treated like spaces. |
|
Each word is capitalized. |
|
A resource beginning with |
|
Examples:
Permission | Resource | Action | Type |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Capability Name Rules
The Capability name is the technical identifier derived from the resource and action.
The resource is lowercased, spaces are replaced with underscores, and the action is appended with a dot.
Resource | Action | Capability name |
|---|---|---|
|
|
|
|
|
|
|
|
|
This name is important because it is used for matching, assignment, and synchronization with Keycloak authorization data.
Collision Warning
Two different legacy permissions can map to the same Capability name.
This happens when different permission names map to the same resource and action after normalization.
Examples of why this can happen:
Cause |
|---|