Metadata-Version: 2.4
Name: djangoldp_tamis_onboarding
Version: 1.0.2
Summary: Public registration form, operator review dashboard, and Keycloak provisioning hooks for the TAMIS dataspace.
Home-page: https://git.startinblox.com/djangoldp-packages/djangoldp-tamis-onboarding
Author: Startin'blox
Author-email: jbaptiste@startinblox.com
License: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: djangoldp~=5.0.0
Requires-Dist: djangoldp_account~=5.0.0
Requires-Dist: djangoldp_dashboard~=4.0.0
Requires-Dist: Pillow~=12.0
Requires-Dist: python-magic~=0.4.27
Provides-Extra: include-package-data
Requires-Dist: True; extra == "include-package-data"

# djangoldp_tamis_onboarding

Public registration form, operator review dashboard, and Keycloak provisioning hooks for the [TAMIS](https://git.startinblox.com/dataspaces/tamis) dataspace.

## What's in here

- `RegisterParticipant` model — mirrors the `MediaEnterpriseCredential` VC claim shape (organisation, legal address, sectoral roles, general + billing contacts) plus a state-machine lifecycle (`pending → processing → approved | rejected`).
- `ParticipantAttachment` model — one row per supporting document (K-bis, VAT cert, PROCIREP/ISAN proofs, etc.); files land in a private storage tree scoped per participant.
- Public multi-step registration form (`/registration/`) + success page.
- Operator dashboard (`/registration/admin/`) — Django-side approve / deny flow.
- Keycloak provisioning stub (`keycloak_service.py`) + background provisioning task (`tasks.py`) triggered on `processing`.
- Email templates for admin notifications, rejection, and welcome.
- `./manage.py generate_sample_documents` — plausible random supporting documents for demos and testing.

## Requirements

- Python ≥ 3.10, Django 5.2, DjangoLDP 5.0
- Pillow (logo re-encoding and sample-doc rendering)
- python-magic + system `libmagic1` (content-based MIME sniffing on uploads)
- `setuptools<80` in the host environment — DjangoLDP still imports `pkg_resources`, which setuptools 80+ deprecates at import time (setuptools' own warning message says "<81" but the deprecation shipped in 80.x). Pin it in your image with `pip install 'setuptools<80'` before installing this package.

## Install

```
pip install djangoldp-tamis-onboarding
```

Add to your DjangoLDP `settings.yml`:

```yaml
dependencies:
  - djangoldp-tamis-onboarding

ldppackages:
  - djangoldp_tamis_onboarding
```

Then wire the URLs under your onboarding prefix (default `onboarding/`):

```python
path("onboarding/", include("djangoldp_tamis_onboarding.urls")),
```

## Configuration

Settings read by the package (all optional except `TAMIS_ADMIN_MAILS`):

| Setting | Purpose |
| --- | --- |
| `TAMIS_ADMIN_MAILS` | List of operator emails notified on each new submission. |
| `ONBOARDING_PREFIX` | URL prefix the host mounts the app under (default `""`). |
| `ONBOARDING_HOMEPAGE_URL`, `ONBOARDING_DOCUMENTATION_URL`, `ONBOARDING_SUPPORT_EMAIL` | Links shown on the success page. |
| `TAMIS_ONBOARDING_PRIVATE_MEDIA_ROOT` | Directory for attachment bytes, kept outside `MEDIA_ROOT` so nginx can't serve them directly. Defaults to `<MEDIA_ROOT>-private/`. |
| `TAMIS_ONBOARDING_USE_XACCEL` | When `True`, the operator download view emits `X-Accel-Redirect` instead of streaming the file. Requires an `internal;` nginx `location /internal-attachments/` block mapped to `TAMIS_ONBOARDING_PRIVATE_MEDIA_ROOT`. |
| `KEYCLOAK_BASE_URL`, `KEYCLOAK_REALM`, `KEYCLOAK_CLIENT_ID`, `KEYCLOAK_CLIENT_SECRET` | Read by `keycloak_service.py` (stubbed in Phase 1). |

## Runnable stack

The [`governance-services/`](https://git.startinblox.com/dataspaces/tamis/-/tree/main/governance-services) docker-compose stack in the TAMIS workspace bundles this package with Keycloak + Postgres + nginx for local and staging onboarding.

## Sample documents

Generate plausible K-bis, VAT certificates, PROCIREP/ISAN membership proofs for manual testing:

```
./manage.py generate_sample_documents --output ./sample-docs --count 3 --format both
```

## License

MIT.
