Module: Plutonium::Wizard::Gate

Extended by:
ActiveSupport::Concern
Defined in:
lib/plutonium/wizard/gate.rb

Overview

Controller concern that gates access behind a one-time wizard (§9).

ensure_wizard_completed(WizardClass) installs a before_action that recomputes the wizard's instance_key (from its concurrency_key — resolved against the host controller's identity context, with the tenant folded in, §4.4) and checks whether a retained completed row exists at that key. If not, it stashes the intended destination and redirects into the wizard's entry step; once the wizard's own finalize retains the completion marker, the gate lets the user through and the controller bounces back to the stashed destination (PRG, wired in Controller).

class DashboardController < AdminPortal::PlutoniumController
include Plutonium::Wizard::Gate
ensure_wizard_completed OnboardingWizard
end

Only one-time wizards (a concurrency_key plus one_time) are gateable — they are the only ones with a durable retained marker. Gating any other wizard raises a clear error at install time.

The instance_key recomputation MUST match the runner/driving digest exactly (both go through compute_instance_key), or the gate would never see the completion the wizard recorded.