Explain access
Clear answers for every access check
Stop guessing why a customer is blocked. Every decision returns a stable code and a plain reason, plus the matching rule or team when an allow or explicit deny decided it.
- Request
- Ada Park → delete
project "Q3 report" - Admin of Acme
- yes
- Contractor of Acme
- block
- Verdict
- Denied
- Reason
- A block always wins.
01 · Explain access
Readable reasons on every decision
Every allow or deny carries a machine-readable code and a plain explanation, along with the matching rule for ALLOWED and EXPLICIT_DENY.
- Request
- Sam Lee → edit
project "Q3 report" - Editor of Acme
- yes
- Verdict
- Allowed
- Reason
- Sam is an Editor of Acme.
02 · Explain access
Audited lookup for support teams
Switch on inspection so authorized support engineers can check why a user cannot open an item. Lookups are rate-limited, and Rolebook records an audit event before returning an explanation.
- Request
- Ada Park → delete
project "Q3 report" - Admin of Acme
- yes
- Contractor of Acme
- block
- Verdict
- Denied
- Reason
- A block always wins.
03 · Explain access
Preview impact before shipping changes
Compare policy versions and preview who would gain or lose access on a sample before publishing a role update.
- Request
- Admin: remove delete
workspace Acme - Kai Ito
- loses delete
- Lena Moss
- loses delete
- Rui Diaz
- loses delete
- Verdict
- 3 people lose access
For developers
Same check, bounded rule trace attached
explain() runs the exact same evaluation path as check(), returning a bounded trace (up to 64 entries) of the rules considered.
Read the docsimport { authorization, project } from "./check";
const explanation = authorization.explain({ permission: "project:delete", resource: project });
explanation.code; // "EXPLICIT_DENY"
explanation.reason; // "A deny rule matched."
explanation.matched; // { effect: "deny", role: "contractor", permission: "project:delete" }
explanation.trace; // every rule Rolebook evaluated, and whether it matched
authorization.enforce({ permission: "project:delete", resource: project });
// throws AuthorizationError, with the decision on error.decision