Skip to content

0035 — Admin is the highest role the Support scope needs

Status: accepted (2026-11-20). Amends 0018 and the approval rule of the Support Templates work (migration 153).

Context

Approving, activating and publishing support content, editing system email templates, changing the three contact/staff-inbox settings and the four support DELETEs all required Super Admin (users.is_super_admin). The owner runs the store with Admin accounts and wants Admin to be the highest role needed to manage Support.

Decision

  • Inside the Support scope only (the /support-desk/* content routes and the /admin/support/* configuration routes), the checks use a verified Admin (is_admin, re-read from Postgres on every request by AdminOnly / SupportStaffOnly). LocalIsAdmin is now set by AdminOnly too. A support agent (is_support only) is never an Admin. A legacy Super Admin is an Admin, so nobody is locked out; no role value, column or audit row is removed or rewritten, and no migration is needed.
  • Unchanged, deliberately: every Super Admin gate outside Support (granting/revoking privileges, user deletion, refund execution, identity withdrawal, referral codes, the accounting-portal roles). Those protect money and identity, not support wording.
  • System templates (the transactional emails and the automatic replies such as the delay notice) are edited in place by an Admin in the Support Portal, on the same support_templates row the mailer reads (id, key, kind and status untouched, so queued mail and workflows keep resolving it; the next message uses the new wording). The text is validated with the same placeholder rules, must keep its required variables ({{ticket_number}} for every system email; {{delay_reason}} and {{revised_date}} for the delay notice), and the edit is audited (SUPPORT_SYSTEM_TEMPLATE_EDITED). Saving or previewing sends nothing.
  • Custom reply templates keep the draft → approved → active lifecycle; an Admin approves, activates and deactivates; editing returns a template to draft. Only an ACTIVE, approved reply is offered in a ticket's reply box, and choosing one only fills the editable box.
  • Delete: an Admin may delete a custom template that is not active. A system template is never deleted (409 with the reason: deactivate it or edit its wording), and an active one must be deactivated first.
  • New email templates cannot be created: the system sends a fixed set of emails.