Skip to content

Permissions and scopes ​

The framework uses a two-layer model: capability codes decide whether an action is allowed, and data scopes decide which rows are visible.

The two layers ​

LayerTargetTypical usage
Capability codeRoutes, buttons, APIscan('system.user.create')
Data scopeQuery and write rowsGate policies filter by department or creator

Neither layer replaces the other. Holding a capability code does not grant visibility of all data, and data within scope does not grant arbitrary actions.

Permissions

Capability codes ​

  • Defined in migrations and grouped by module
  • Checked centrally at the route layer, with optional second checks in controllers
  • Frontend hides buttons by code, while the server always validates independently

Data scope gates ​

  • A Gate is a data-scope policy name, not a capability code
  • List queries are filtered automatically to prevent unauthorized reads
  • Write operations verify each target row against the scope
  • Structural operations such as department sorting and parent selection are scope-checked too

Extending scopes ​

Implement a custom Gate and call it from the service layer. The framework does not bind to a specific business dimension; department, tenant or creator filters can all be integrated.

Next steps ​