GuardAgent.authorize
function · packages/guard/src/agent.ts:56
authorize<Input, Model>(
interaction: 'Update' | 'Delete' | InteractionKey,
row: (request: { readonly input: Input; readonly model: Model }) => MayRow,
): (request: {
readonly input: Input
readonly model: Model
}) => boolean | { readonly allowed: false; readonly reason: string }A capability's authorize: the row the request names, read from the
Model, must let the principal do interaction. A row not read yet, or
whose read failed, refuses: there is no answer to go on. A refusal its
rule explained says so, as the agent's error.
ts
authorize: GuardAgent.authorize(Archive.key, ({ input, model }) =>
Data.get(TodoRow, input.id).read(model),
)