OptionalcanRoles that are explicitly ALLOWED to read this field/model. If this array is present (even empty), only roles in this list can read. A '*' entry means "any role".
OptionalcannotRoles that are explicitly DENIED read access, regardless of canView.
OptionalcanRoles that are explicitly ALLOWED to write this field. If this array is present, only roles in this list can write.
OptionalcannotRoles that are explicitly DENIED write access.
OptionaldescriptionHuman-readable description of the permission rule (for docs/tooling).
Permission / access-control decorators for the ORM.
These decorators let you annotate model classes and individual fields with access rules — which roles can read, write, or are completely blocked from a field or an entire model. At query time you call filterByPermissions() to strip out any fields the current user is not allowed to see.
────────────────────────────────────────────────────────────────────────── Quick Reference ──────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────── Example ──────────────────────────────────────────────────────────────────────────
// Field-level permissions (applied via static registration): PermissionRegistry.addFieldRule(User, 'ssn', { canView: ['admin'] }); PermissionRegistry.addFieldRule(User, 'salary', { canView: ['admin', 'hr'] }); PermissionRegistry.addFieldRule(User, 'password', { canView: [] }); // nobody