Back to Engineering Notes
Flagship ArchitectureHospital Manage

Why I Chose Capability Snapshots Over Runtime Permission Computation

This note explains why authorization had to become a versioned artifact rather than a runtime join problem.

Problem

Hospital authority changes across organization, hospital, branch, department, designation, and user-specific exceptions.

If every request had to recompute effective permissions from those inputs, request-time latency and reasoning complexity would both grow with the model.

The system also needed a clean way to tell the frontend what a user could likely do without turning UI gating into the security model.

Why It Was Difficult

Designation rules, restrictions, and overrides do not all live at the same scope, so recomputation is not a simple role lookup.

Operational users move through different workspaces and contexts, which means authority must remain explainable when the same person acts in different branches or departments.

Caching alone could make the system feel faster, but caching is not authorization. The authoritative answer still has to come from a durable model.

Core Decision

The authoritative permission model is a durable, versioned capability snapshot at the database layer. Request-time authorization looks up the snapshot instead of recomputing the entire permission graph.

Solution

Capability snapshots are generated from organization rules, designation authority, restrictions, and overrides, then stored as immutable, versioned records.

A lighter workspace snapshot is derived from the latest capability snapshot so the UI can bootstrap menus, visibility, and affordances quickly.

Runtime authorization validates session, scope, staff profile, requested action, and the latest relevant capability snapshot through RPC or database checks.

Frontend gating stays advisory. The authoritative enforcement path is the backend snapshot lookup and action validation.

Impact

Request-time authorization becomes a lookup problem instead of repeated graph recomputation.

The UX can load with a workspace snapshot while still deferring real security decisions to backend checks.

Authorization logic becomes easier to explain in architecture terms because the durable artifact is explicit and versioned.

Tradeoff

Snapshot generation introduces more background logic and invalidation boundaries.

The system must carefully define when a new snapshot is required and how older snapshots remain inspectable.

This is more structural work up front, but it keeps runtime checks understandable as governance complexity grows.

Ownership note

AI-assisted implementation. Architecture, decisions, tradeoffs, and UX ownership were mine.

Related Notes

Hospital Manage

Designing Multi-Level Authorization Without Scattering Permission Checks

Authorization becomes difficult when authority is affected by organization rules, hospital restrictions, branch context, department scope, designations, and user overrides.

Hospital Manage

Designing Workflow Execution Around Auditability

Hospital operations contain appointments, encounters, approvals, and clinical actions. These should not be silent updates; they should be traceable workflow transitions.

Next step

Trace the note back to the system, or continue the conversation.

These notes are part of larger systems work. You can return to the related project context or reach out if you need someone who can reason through workflows, authorization, and operational software without making them harder to operate.