Content Manager RBAC#
Role-based access control in the Content Manager is enforced through two complementary layers: permission registration (which actions and subjects exist) and permission checking at runtime (whether a given user can perform an action). Two notable behaviors in this area are the handling of hidden content types as explorer.read subjects, and the mainField sanitization fallback in relation controllers.
Permission Registration#
Permissions are registered on startup via registerPermissions() in packages/core/content-manager/server/src/services/permission.ts. The key asymmetry:
| Action | Subject set |
|---|---|
explorer.create, explorer.update, explorer.delete, explorer.publish | Displayed content types only (isDisplayed === true) |
explorer.read | All content types, including hidden ones |
This means hidden content types (e.g., plugin::users-permissions.role) are valid explorer.read subjects even though they never appear in the CM sidebar .
Why? A hidden type like plugin::users-permissions.role can still be the target of a relation on a displayed type (e.g., plugin::users-permissions.user). Without an explorer.read subject entry, resetSuperAdminPermissions would never create the permission row, causing a "Policy Failed" / 403 when the admin UI fetched the relation target ā see PR #26844.
Hidden Types in the Roles UI#
Even though hidden content types are valid explorer.read subjects, they are deliberately excluded from the Roles permissions configuration screen. Two places enforce this:
contentTypesBasehandler ā strips non-visible UIDs fromaction.subjectsbefore building the UI section .subjectsHandlerForhandler ā filters content types bypluginOptions['content-manager'].visible !== falsewhen populating the section's subjects list .
Both checks use the same condition: pluginOptions['content-manager'].visible === false means "hidden from CM" .
Editor / Author Default Permissions#
When the three default roles are bootstrapped via createRolesIfNoneExist(), hidden UIDs are collected and passed as restrictedSubjects when generating Editor and Author permissions . This keeps hidden content types accessible only to Super Admin for relation reads, not to standard roles.
Runtime Permission Checker#
At request time, controllers obtain a permissionChecker from permission-checker.ts (packages/core/content-manager/server/src/services/permission-checker.ts). The checker wraps a CASL Ability object and exposes:
can(action, entity?, field)/cannot(...)ā evaluate the ability, also resolving action aliases.sanitizeOutput,sanitizeQuery,sanitizeInputā strip data the user cannot see/write .sanitizedQuery[action]shortcuts ā compose query sanitization + permission query injection .
Registered action IDs :
| Shortcut | Action ID |
|---|---|
read | plugin::content-manager.explorer.read |
create | plugin::content-manager.explorer.create |
update | plugin::content-manager.explorer.update |
delete | plugin::content-manager.explorer.delete |
publish / unpublish | plugin::content-manager.explorer.publish |
discard | plugin::content-manager.explorer.update |
Relation mainField Sanitization Fallback#
When the relations controller resolves which field to display as a label in a relation picker, it calls sanitizeMainField() in packages/core/content-manager/server/src/controllers/relations.ts.
The function checks two conditions :
isListable(model, mainField)ā is the field allowed to appear in list views regardless of permissions?permissionChecker.can.read(null, mainField)ā does the current user's RBAC ability grant read access to that field on the target model?
If either check fails, mainField falls back to 'documentId'. This prevents exposing field values the user does not have read permission on while still returning enough data (the document ID) to identify the related record.
The resolved mainField then drives the fields selected in both findAvailable and findExisting queries , and is used as the sort key for available-relations search .
Edge case: plugin::users-permissions.role always gets 'name' as its mainField regardless of config .
findExisting Two-Query Pattern#
For existing relations, the controller uses a two-pass query to handle cases where custom conditions restrict access to some relations:
- First pass ā load all relation IDs (no field selection beyond IDs).
- Second pass ā reload with the full
sanitizedQuery(which filters by RBAC conditions); forbidden relations are excluded here. - Union ā merge results, prioritizing the sanitized set, so forbidden relations appear as ID-only stubs rather than disappearing entirely .
Key Source Files#
| File | Purpose |
|---|---|
content-manager/server/src/services/permission.ts | Action registration; explorer.read on all types |
content-manager/server/src/services/permission-checker.ts | Runtime CASL-based checker and sanitizers |
content-manager/server/src/controllers/relations.ts | mainField sanitization; findAvailable / findExisting |
admin/server/src/services/permission/sections-builder/handlers.ts | Roles UI ā strips hidden types from configurable subjects |
admin/server/src/services/role.ts | Default role bootstrapping; restrictedSubjects for hidden types |