TenantAtlas/specs/024-terms-and-conditions/spec.md
2026-01-04 01:58:41 +01:00

52 lines
2.6 KiB
Markdown

# Feature Specification: Terms & Conditions (Enrollment Experience) (024)
**Feature Branch**: `feat/024-terms-and-conditions`
**Created**: 2026-01-04
**Status**: Draft
**Priority**: P1
## Context
Terms & Conditions (T&C) are part of the **Enrollment Experience**. During tenant rebuilds / recovery they are frequently missed, but can be required for compliant onboarding.
## User Scenarios & Testing
### User Story 1 — Inventory + readable view (Priority: P1)
As an admin, I can see Terms & Conditions policies in the Policies inventory and view their configuration in a readable way.
**Acceptance Scenarios**
1. Given a tenant with T&C configured, when I sync policies, then T&C items appear with type `termsAndConditions`.
2. Given a T&C policy, when I open its detail page, then I see a normalized settings view (not only raw JSON).
### User Story 2 — Snapshot capture + versioning (Priority: P1)
As an admin, I can capture versions and backups of Terms & Conditions so I can diff and roll back safely.
**Acceptance Scenarios**
1. Given a T&C policy, when I capture a snapshot, then the full Graph payload is stored immutably (JSONB).
2. Given two versions, when I view a diff, then changes are human-readable and structured.
### User Story 3 — Restore preview + execution (Priority: P2)
As an admin, I can restore Terms & Conditions (with assignments) from a snapshot with a safe preview, audit logging, and defensive checks.
**Acceptance Scenarios**
1. Given a backup item of type `termsAndConditions`, when I run restore preview, then it shows create/update + restore mode and warnings.
2. Given restore execution, when Graph rejects non-patchable fields, then TenantPilot strips them (contract-driven) and retries safely.
## Requirements
### Functional Requirements
- **FR-001**: Add policy type `termsAndConditions` backed by Graph `deviceManagement/termsAndConditions`.
- **FR-002**: Capture full payload snapshots and include assignments.
- **FR-003**: Restore supports create/update (contract-driven sanitization) and assignment apply.
- **FR-004**: Normalized settings view exists for key fields (displayName, description, title, body, acceptance statement, etc.).
- **FR-005**: Add Pest tests for sync + snapshot + restore preview + restore execution.
### Non-Functional Requirements
- **NFR-001**: All writes require explicit confirmation and create audit logs.
- **NFR-002**: Tenant isolation applies end-to-end (no cross-tenant leakage).
## Success Criteria
- **SC-001**: T&C appears in inventory and backups.
- **SC-002**: Restore preview is actionable and safe.
- **SC-003**: Restore execution works with assignments (where Graph allows).