Allinea il PRODOTTO alla guida/normativa portando la compliance dal livello 10 misure Art.21 al livello operativo dei requisiti ACN (Framework Nazionale 2025). - Migrazione 031: acn_requirements (catalogo) + org_acn_requirement_status (stato per-org) - Seed da Allegati 1-2 ACN (fonte certa, parsing verificato): 87 importanti + 116 essenziali = 203 requisiti reali - AuditController: acnRequirements (GET, per entity_type org: importanti 87 / essenziali 116, summary per funzione GV/ID/PR/DE/RS/RC, % compliance) + updateAcnRequirement (PUT stato+evidenza) - Route audit/acnRequirements GET/PUT - guida.html: fix refuso cap-5 (residuo 'otto categorie...no' -> '10 categorie x 8, quattro modalita') E2E prod: org importante -> 87 req; PUT implemented -> compliance aggiornata. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
50 lines
2.7 KiB
SQL
50 lines
2.7 KiB
SQL
-- ============================================================================
|
|
-- Migration 031 - Requisiti ACN (specifiche di base, Determina 164179/2025)
|
|
-- ----------------------------------------------------------------------------
|
|
-- Porta la Gap Analysis dal livello "10 misure Art.21" al livello operativo
|
|
-- dei requisiti ACN (Framework Nazionale 2025): 87 per soggetti importanti,
|
|
-- 116 per essenziali. Additiva: nuove tabelle, non tocca compliance_controls.
|
|
--
|
|
-- acn_requirements = catalogo globale (fonte: Allegati 1-2 ACN)
|
|
-- org_acn_requirement_status = stato di implementazione per organizzazione
|
|
--
|
|
-- Idempotente. mysql -h localhost nis2_agile_db -e "source docs/sql/031_acn_requirements.sql"
|
|
-- ============================================================================
|
|
|
|
CREATE TABLE IF NOT EXISTS acn_requirements (
|
|
id INT NOT NULL AUTO_INCREMENT,
|
|
entity ENUM('importante','essenziale') NOT NULL,
|
|
function_name VARCHAR(40) NOT NULL COMMENT 'Governance/Identificazione/Protezione/Rilevazione/Risposta/Ripristino',
|
|
subcategory VARCHAR(20) NOT NULL COMMENT 'Codice sottocategoria framework, es. GV.OC-4',
|
|
subcategory_text TEXT NULL,
|
|
req_index INT NOT NULL COMMENT 'Numero del requisito entro la sottocategoria',
|
|
requirement TEXT NOT NULL COMMENT 'Testo del requisito (fonte: Allegato ACN)',
|
|
art21_letter CHAR(1) NULL COMMENT 'Mapping indicativo a Art.21.2 (a..j), opzionale',
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (id),
|
|
UNIQUE KEY uq_acn_req (entity, subcategory, req_index),
|
|
KEY idx_acn_entity (entity),
|
|
KEY idx_acn_func (function_name)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
|
COMMENT='Catalogo requisiti specifiche di base ACN (Determina 164179/2025, Allegati 1-2)';
|
|
|
|
CREATE TABLE IF NOT EXISTS org_acn_requirement_status (
|
|
id INT NOT NULL AUTO_INCREMENT,
|
|
organization_id INT NOT NULL,
|
|
requirement_id INT NOT NULL,
|
|
status ENUM('not_started','in_progress','implemented','not_applicable') NOT NULL DEFAULT 'not_started',
|
|
evidence_note TEXT NULL,
|
|
updated_by INT NULL,
|
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (id),
|
|
UNIQUE KEY uq_org_req (organization_id, requirement_id),
|
|
KEY idx_oar_org (organization_id),
|
|
KEY idx_oar_req (requirement_id)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
|
COMMENT='Stato di implementazione dei requisiti ACN per organizzazione';
|
|
|
|
-- ROLLBACK:
|
|
-- DROP TABLE IF EXISTS org_acn_requirement_status;
|
|
-- DROP TABLE IF EXISTS acn_requirements;
|