diff --git a/docs/deployment.md b/docs/deployment.md index 173522d..b0330e3 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -71,6 +71,12 @@ read -rs PW; printf '%s' "$PW" | docker run --rm -i httpd:2.4-alpine htpasswd -i After running `04`, `SELECT LENGTH(password) FROM \`service-system\`.\`user\` WHERE id = 1;` must return 60. The administrator signs in as `admin` and must set a new password before anything else. +**Later SQL, after the package, in this order:** + +| File | What it does | +|---|---| +| `openspec/changes/archive/2026-11-30-add-admin-email-listing/sql/01-email-module.sql` | Adds the Emails back-office module (`BO_EMAILS`). | + **Database user:** - Create one user with `SELECT, INSERT, UPDATE, DELETE, EXECUTE` on the five schemas. EXECUTE is needed: service-member calls a stored function. - Every Java service reads the same variables (section 6): `MYSQLHOST`, `MYSQLPORT`, `MYSQLUSER`, `MYSQLPWD`. @@ -257,7 +263,7 @@ data: ## 10. Known gaps at go-live -- **No email provider yet.** Staff onboarding does not need one: the admin types each new user's first password, and "Set temporary password" on a user's page unlocks a user who forgot theirs. Both force a password change at the next sign-in. Forgot-password and "Send password reset" do send email, so they do not work until a provider is configured in `service-email`. +- **No email provider yet.** Staff onboarding does not need one: the admin types each new user's first password, and "Set temporary password" on a user's page unlocks a user who forgot theirs. Both force a password change at the next sign-in. Forgot-password and "Send password reset" still create an email with a temporary password. Nobody receives it, but `service-email` saves every email first, so a super admin (or a role granted Emails) can read it under **Emails** and pass the password on in person. The user must change it at the next sign-in. Grant Emails narrowly: it shows every saved email, including other users' temporary passwords, member email-verification codes, and contact or distributor form submissions with the sender's personal data. - **Reference data from Tastefully.** It still holds some Tastefully business text (message templates with a phone number, bank account and form links; a public image bucket URL; Tastefully usernames in audit columns). Review it before go-live. - **Other Tastefully defaults.** The sender addresses in `service-email` and the `CUSTOMER_PORTAL_BASE_URL` fallback point at Tastefully. Override them as described in section 6. - **Leaked SMS key.** An SMS360 API key from Tastefully was in `service-email`'s config and is in git history. It has been removed from the config, but it must be rotated with SMS360 before go-live, by whoever owns that Tastefully account. diff --git a/local/seed/03-colite.sql b/local/seed/03-colite.sql index 4fa0862..1c04766 100644 --- a/local/seed/03-colite.sql +++ b/local/seed/03-colite.sql @@ -1,6 +1,8 @@ -- Local dev only. Applies the change SQL (company, BO modules) and creates one admin login. -- Admin login: admin / colite-dev-admin (dev password, documented in local/README.md). -- Keep the statements below in step with openspec/changes/*/sql/ (and the archive once archived). +-- The release package (add-release-ci-packaging/sql/03-colite.sql) is frozen; this seed equals that +-- package plus the later change SQL listed in docs/deployment.md section 3, plus the dev admin login. USE `service-system`; -- add-admin-auth-users-roles/sql/01-company.sql @@ -118,3 +120,7 @@ INSERT INTO `module` (`id`, `name`, `desc`, `area`, `type`, `parent`, `url`, `ic (40400000, 'BO_LEADS', 'Leads', 'BO', 'M', 40000000, '/leads', 'Users'), (40500000, 'BO_LEADS_EDIT', 'Edit leads', 'BO', 'M', 40000000, NULL, NULL), (40600000, 'BO_LEADS_EXPORT', 'Export leads', 'BO', 'M', 40000000, NULL, NULL); + +-- add-admin-email-listing/sql/01-email-module.sql +INSERT INTO `module` (`id`, `name`, `desc`, `area`, `type`, `parent`, `url`, `icon_name`) VALUES + (40900000, 'BO_EMAILS', 'Emails', 'BO', 'M', 40000000, '/emails', 'Mail'); diff --git a/openspec/changes/add-admin-email-listing/.openspec.yaml b/openspec/changes/add-admin-email-listing/.openspec.yaml new file mode 100644 index 0000000..4a154df --- /dev/null +++ b/openspec/changes/add-admin-email-listing/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-30 diff --git a/openspec/changes/add-admin-email-listing/design.md b/openspec/changes/add-admin-email-listing/design.md new file mode 100644 index 0000000..615f1d5 --- /dev/null +++ b/openspec/changes/add-admin-email-listing/design.md @@ -0,0 +1,59 @@ +# Design + +## Context + +- **Storage:** `service-email`'s `/email/send` saves the email (subject, body, recipients, status) before it publishes it for sending. Every email is in `service-email`.`email`, with its recipients in `recipient`, whether or not a provider delivered it. +- **Existing queries in service-email:** + - `/email/findByPropertyAndPageable` takes `{property, pageableRest}`. The supported properties are `id`, `sender`, `subject`, `recipient` (a join, matched with like) and `startDate`/`endDate` (dd-MM-yyyy, the `system.dateformat` in core-libs). + - `/email/findById/{id}` returns the email with its body and recipients, or an empty body when there is none. +- **Who sends password emails:** services-system's `resetAdminPassword` (admin reset and admin forgot-password) and the member password paths. +- **Access model:** `@AdminModule` on mobile-api handlers. A super admin (role id 1) passes every module check and sees every menu entry. The portal menu comes from the `module` table (`url`, `icon_name`). +- **Reference:** babyboo's `AdminEmailTemplateController` (`/email-logs`, `/email-logs/{id}`) and `app/email-templates/logs/[id]`, which renders the body in an `