Files
co-lite/openspec/specs/admin-emails/spec.md
T

2.8 KiB

admin-emails Specification

Purpose

Let authorised admins read the emails the system has saved, so a temporary password can be passed on in person while no email provider is configured.

Requirements

Requirement: Email listing

The system SHALL let an admin with BO_EMAILS list the saved emails, newest first, showing each email's date, recipients, subject and status. The list SHALL filter by recipient, subject and date range, and SHALL be paged. The list SHALL NOT include any email body.

Scenario: Newest first

  • GIVEN a forgot-password email to sales1@example.com was saved after an earlier email
  • WHEN an admin with BO_EMAILS opens the emails listing
  • THEN the forgot-password email is listed first with its date, recipient, subject and status
  • AND no email body is part of the list response

Scenario: Filter by recipient

  • WHEN an admin filters the listing by recipient sales1
  • THEN only emails with a recipient containing sales1 are listed

Requirement: Email detail

The system SHALL let an admin with BO_EMAILS open one saved email and see its body. The portal SHALL show the body in a sandboxed frame that runs no scripts. Opening an email SHALL write an audit log line naming the email id and the viewer, and that line SHALL NOT contain the body.

Scenario: Read a temporary password

  • GIVEN sales1 used forgot-password and no email provider is configured
  • WHEN an admin with BO_EMAILS opens that email
  • THEN the admin sees the body with the temporary password
  • AND the log records that the admin viewed that email, without the body

Scenario: Unknown email

  • WHEN an admin opens an email id that does not exist
  • THEN the system answers not found

Requirement: Super admin emails protected

The system SHALL refuse to show the body of an email addressed to a super admin when the caller is not a super admin. The email SHALL still appear in the listing.

Scenario: Regular admin opens a super admin's email

  • GIVEN a forgot-password email to a super admin's address
  • AND the caller has BO_EMAILS but is not a super admin
  • WHEN the caller opens that email
  • THEN the request is refused and no body is returned

Scenario: Super admin opens it

  • GIVEN a forgot-password email to a super admin's address
  • WHEN a super admin opens that email
  • THEN the body is shown

Requirement: Emails module gate

The emails listing and detail SHALL require the BO_EMAILS module. The module SHALL be seeded with no role grants, so only super admins can use it until a super admin grants it to a role.

Scenario: Without the module

  • GIVEN an admin whose roles do not include BO_EMAILS
  • WHEN they call the emails listing or detail
  • THEN the request is refused
  • AND the Emails menu entry is not shown to them