Skip to main content

Permissions

Every feature defines its permission before any handler, page or button. Rust is the single source of truth.

StepWhereCommand or call
1. Definecrates/medbrains-core/src/permissions.rs, with a /// doc comment. The first sentence becomes the UI label—
2. Generatepackages/types/src/permissions.ts (never hand-edit)python3 scripts/generate_permissions_ts.py
3. Grantcrates/medbrains-core/src/access/roles.rsthe compiler checks the reference
4. Guard the serverthe handler or servicerequire_permission(&claims, permissions::…), or Authorized<R> / AllOf / AnyOf
5. Gate the UIthe route and each mutating controluseRequirePermission, useHasPermission
6. Prove—make check-permissions, make check-role-templates

A missing permission is created, never borrowed from a nearby one. A fault in an authorization check is never collapsed into "denied".

The full rules, including the four axes every module must satisfy, are in ENGINEERING.md and RFCs/RFC-AUTHZ-2026-001-Design-and-Grammar.md.