Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#27](https://github.com/BIPLAT-CIBERINFEC/pathocore-api/pull/27) Move API documentation under `/v1`
- [#28](https://github.com/BIPLAT-CIBERINFEC/pathocore-api/pull/28) Keep API documentation public
- [#30](https://github.com/BIPLAT-CIBERINFEC/pathocore-api/pull/30) Thread access request notification emails
- [#32](https://github.com/BIPLAT-CIBERINFEC/pathocore-api/pull/32) Send access request notifications as multipart plain-text and HTML emails.
- [#32](https://github.com/BIPLAT-CIBERINFEC/pathocore-api/pull/32) Show access request use-case links only after approval.

### `Added`

Expand All @@ -24,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#17](https://github.com/BIPLAT-CIBERINFEC/pathocore-api/pull/17) Notify use-case admins of pending access requests
- [#18](https://github.com/BIPLAT-CIBERINFEC/pathocore-api/pull/18) Use English copy in API response payloads
- [#26](https://github.com/BIPLAT-CIBERINFEC/pathocore-api/pull/26) Support proxy CSRF settings for admin forms behind HTTPS reverse proxies
- [#31](https://github.com/BIPLAT-CIBERINFEC/pathocore-api/pull/31/) Add a `send_test_email` management command and configurable Django email backend.

### `Fixed`

Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,10 @@ safe defaults and normally do not need to be changed.
| `EMAIL_PORT` | `1025` or `587` | SMTP port. |
| `EMAIL_HOST_USER` | SMTP username | Optional SMTP auth username. |
| `EMAIL_HOST_PASSWORD` | SMTP password | Optional SMTP auth password. |
| `EMAIL_BACKEND` | `django.core.mail.backends.smtp.EmailBackend` | Django email backend. Use `django.core.mail.backends.console.EmailBackend` for CLI-only development checks. |
| `EMAIL_USE_TLS` | `false` or `true` | Whether SMTP uses TLS. |
| `DEFAULT_FROM_EMAIL` | `no-reply@pathocore.local` | Sender shown in PathoCore API emails. |
| `ALLOWED_EMAIL_DOMAINS` | `ciberisciii.es,externos.isciii.es` | Optional comma-separated recipient domain allow-list for the test email command. |
| `PATHOCORE_ACCESS_REQUEST_ADMIN_EMAILS` | `admin@example.org` | Optional fallback/copy recipients if Keycloak use-case admins are not found. |

New access requests notify admins from the Keycloak group
Expand Down Expand Up @@ -518,15 +520,29 @@ matching use-case admin group, for example `/use-cases/mepram/admin`. Configure
`PATHOCORE_ACCESS_REQUEST_ADMIN_EMAILS` only as a fallback or general copy.
Rejected and revoked notifications include the review note as the reason and
the available use-case admin contact emails.
All access request workflow emails include a plain-text footer with PathoCore /
MEPRAM DataHub and the technical platform links.
Access request workflow emails are sent as multipart plain text and HTML.
The HTML version presents the requested use-case, role and web section in a
structured summary instead of exposing raw group paths in the main sentence.

In the local Docker test stack these messages are captured by Mailpit:

```text
http://127.0.0.1:8025
```

Send a test email with the active Django settings:

```bash
python manage.py send_test_email user@example.org
```

For a console-only check, override the backend:

```bash
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend \
python manage.py send_test_email user@example.org
```

Revocation removes the approved Keycloak group but does not disable the whole
account.

Expand Down
2 changes: 2 additions & 0 deletions conf/docker_production_settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ EMAIL_HOST="change_me_smtp_host"
EMAIL_PORT=587
EMAIL_HOST_USER=""
EMAIL_HOST_PASSWORD=""
EMAIL_BACKEND="django.core.mail.backends.smtp.EmailBackend"
EMAIL_USE_TLS="true"
DEFAULT_FROM_EMAIL="no-reply@pathocore.local"
ALLOWED_EMAIL_DOMAINS=""

### Logs settings
LOG_TYPE="regular_folder"
Expand Down
2 changes: 2 additions & 0 deletions conf/docker_test_settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ EMAIL_HOST="mailpit"
EMAIL_PORT=1025
EMAIL_HOST_USER=""
EMAIL_HOST_PASSWORD=""
EMAIL_BACKEND="django.core.mail.backends.smtp.EmailBackend"
EMAIL_USE_TLS="false"
DEFAULT_FROM_EMAIL="no-reply@pathocore.local"
ALLOWED_EMAIL_DOMAINS=""

### Logs settings
LOG_TYPE="regular_folder"
Expand Down
2 changes: 2 additions & 0 deletions conf/template_install_settings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ EMAIL_HOST=""
EMAIL_PORT=587
EMAIL_HOST_USER=""
EMAIL_HOST_PASSWORD=""
EMAIL_BACKEND="django.core.mail.backends.smtp.EmailBackend"
EMAIL_USE_TLS="true"
DEFAULT_FROM_EMAIL="no-reply@pathocore.local"
ALLOWED_EMAIL_DOMAINS=""

### Logs settings
LOG_TYPE="symbolic_link" # can be symbolic link, or regular_folder
Expand Down
4 changes: 4 additions & 0 deletions conf/template_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,17 @@ def _csv_env(name, default=None):
EMAIL_PORT = _int_env("EMAIL_PORT", "emailport")
EMAIL_HOST_USER = os.environ.get("EMAIL_HOST_USER", "emailhostuser")
EMAIL_HOST_PASSWORD = os.environ.get("EMAIL_HOST_PASSWORD", "emailhostpassword")
EMAIL_BACKEND = os.environ.get(
"EMAIL_BACKEND", "django.core.mail.backends.smtp.EmailBackend"
)
EMAIL_USE_TLS = os.environ.get("EMAIL_USE_TLS", "emailhosttls").lower() in (
"1",
"true",
"yes",
"on",
)
DEFAULT_FROM_EMAIL = os.environ.get("DEFAULT_FROM_EMAIL", "pathocore-api@localhost")
ALLOWED_EMAIL_DOMAINS = _csv_env("ALLOWED_EMAIL_DOMAINS")

SPECTACULAR_SETTINGS = {
"TITLE": "PathoCore API",
Expand Down
Loading
Loading