auth/cell_authorize.ts view source
(auth: RequestContext | null, cell: CellRow, grants: readonly CellGrantRow[] | null): boolean import {can_edit_cell} from '@fuzdev/fuz_app/auth/cell_authorize.js'; Edit authorization for a cell.
Unauthenticated callers can never edit. Admin always allowed.
IMPORTANT: the cell.created_by === null branch is explicit
defense-in-depth. NULL created_by means system origin (well-known
cells seeded by migration, future daemon/agent cells). Non-admin edits
MUST be denied — editor-level grants do NOT bypass this guard,
because system cells are policy-controlled at admin level. Do NOT
collapse into a single equality check that would silently return
false for NULL via JS equality semantics — the explicit branch
survives refactors and reads as a load-bearing security property.
auth
request context, or null for unauthenticated callers
RequestContext | nullcell
the cell row
grants
the cell's grant list, or null to skip the grant branch
readonly CellGrantRow[] | nullreturns
boolean whether the caller may edit the cell