Files
co-lite/openspec/changes/add-admin-email-listing/proposal.md
T

2.5 KiB

Proposal

Why

No email provider will be configured for go-live on 2027-01-15. Forgot-password and the admin's "Send password reset" still create emails that carry a temporary password, but nobody receives them. service-email saves every email to its database before it tries to send it. So an admin who can read those saved emails can pass the password on in person. This gives self-service forgot-password a workaround until a provider is configured.

The legacy backoffice had an Email Listing screen for this, and babyboo's admin portal has a read-only email log, which this change follows.

What Changes

  • Emails listing (/emails), under a new BO_EMAILS module:
    • Shows saved emails, newest first: date, recipients, subject and status.
    • Filters by recipient, subject and date range, and is paged.
    • The list never carries an email body.
  • Email detail (/emails/[id]): shows one email with its body.
    • The body is shown in a sandboxed frame with no scripts.
    • Opening it writes an audit log line with the email id and the viewer. The line never contains the body.
  • Super admin emails are protected. An admin who is not a super admin cannot open an email addressed to a super admin (403). The list still shows that the email exists. This stops a regular admin from triggering forgot-password for a super admin and reading the password.
  • Access: the module is seeded with no role grants, so only super admins see it at first. They grant it to other roles under Roles.
  • Not in this change: resend, email templates, SMS, and configuring an email provider.

Capabilities

New Capabilities

  • admin-emails: the read-only email listing and detail, the super-admin protection, the audit line, and the module gate.

Modified Capabilities

None.

Impact

  • solvway-mobile-api: GET /api/admin/emails and GET /api/admin/emails/{id} under BO_EMAILS. They read service-email's existing /email/findByPropertyAndPageable and /email/findById/{id}, and look up recipients with services-system /user/findByEmail/{email}.
  • solvway-admin-portal: the /emails list and /emails/[id] detail pages, proxy routes, a service and i18n keys.
  • Database: one new module row, BO_EMAILS, in service-system. It is added to the local seed (local/seed/03-colite.sql), and sql/01-email-module.sql in this change gives it to the DBA.
  • Docs: docs/deployment.md lists the new SQL file, and section 10 explains the workaround.
  • No new dependency, and no change to service-email.