Skip to content

Permissions

Permissions grant each Role a Verb on a Noun in a scope, check every Action before it runs, and narrow unused grants nightly.

Permissions decide what every caller may do: a Permission grants a Role one Verb on one Noun in a scope. Every Action is checked against them before it runs.

Contract

  • A Worker, human or agent, holds Permissions only through the Roles it fills. Owner, admin, member and viewer are presets.
  • A Customer acts by Entitlement, granted by an accepted Offer. An agent acts for a person by Mandate: standing, expiring and revocable.
  • The check runs where the Verb executes, on every call, scheduled and internal ones included. Hiding a button is never the enforcement.
  • A Permission can carry a Limit, such as refunds up to $200 a day.
  • Narrowing takes effect at once. Widening is a Change that needs an Approval, and no agent widens its own Role or raises its own Limit.
  • An agent's key for a Task holds its Role's Permissions, narrowed to the records the Task names.
  • Each night, a grant unused for 30 days narrows by Change. The Role's owner restores it with one Approval.
  • Permission.check explains any decision: allowed or refused, and the rule that decided.

Verbs

Interfaces

Example

TypeScript
import { $ } from 'startup-builder'

// A tutoring marketplace asks whether its support agent may refund a $340 lesson pack.
// Run with the agent's key, try passes every gate and stores nothing.
const preview = await $.try.Order.refund({ order: 'order_1842', reason: 'Lesson pack unused' }).settled
// preview.status: 'pending', with an Approval to open (support: Order.refund up to $200/day)