portfolio/store.go (818 LOC) → store_portfolio.go, store_items.go, store_metrics.go workshop/store.go (793 LOC) → store_sessions.go, store_participants.go, store_responses.go training/models.go (757 LOC) → models_enums.go, models_core.go, models_api.go, models_blocks.go roadmap/store.go (757 LOC) → store_roadmap.go, store_items.go, store_import.go All files under 350 LOC. Zero behavior changes, same package declarations. go vet passes on all five packages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
163 lines
5.1 KiB
Go
163 lines
5.1 KiB
Go
package training
|
|
|
|
// ============================================================================
|
|
// Constants / Enums
|
|
// ============================================================================
|
|
|
|
// RegulationArea represents a compliance regulation area
|
|
type RegulationArea string
|
|
|
|
const (
|
|
RegulationDSGVO RegulationArea = "dsgvo"
|
|
RegulationNIS2 RegulationArea = "nis2"
|
|
RegulationISO27001 RegulationArea = "iso27001"
|
|
RegulationAIAct RegulationArea = "ai_act"
|
|
RegulationGeschGehG RegulationArea = "geschgehg"
|
|
RegulationHinSchG RegulationArea = "hinschg"
|
|
)
|
|
|
|
// FrequencyType represents the training frequency
|
|
type FrequencyType string
|
|
|
|
const (
|
|
FrequencyOnboarding FrequencyType = "onboarding"
|
|
FrequencyAnnual FrequencyType = "annual"
|
|
FrequencyEventTrigger FrequencyType = "event_trigger"
|
|
FrequencyMicro FrequencyType = "micro"
|
|
)
|
|
|
|
// AssignmentStatus represents the status of a training assignment
|
|
type AssignmentStatus string
|
|
|
|
const (
|
|
AssignmentStatusPending AssignmentStatus = "pending"
|
|
AssignmentStatusInProgress AssignmentStatus = "in_progress"
|
|
AssignmentStatusCompleted AssignmentStatus = "completed"
|
|
AssignmentStatusOverdue AssignmentStatus = "overdue"
|
|
AssignmentStatusExpired AssignmentStatus = "expired"
|
|
)
|
|
|
|
// TriggerType represents how a training was assigned
|
|
type TriggerType string
|
|
|
|
const (
|
|
TriggerOnboarding TriggerType = "onboarding"
|
|
TriggerAnnual TriggerType = "annual"
|
|
TriggerEvent TriggerType = "event"
|
|
TriggerManual TriggerType = "manual"
|
|
)
|
|
|
|
// ContentFormat represents the format of module content
|
|
type ContentFormat string
|
|
|
|
const (
|
|
ContentFormatMarkdown ContentFormat = "markdown"
|
|
ContentFormatHTML ContentFormat = "html"
|
|
)
|
|
|
|
// Difficulty represents the difficulty level of a quiz question
|
|
type Difficulty string
|
|
|
|
const (
|
|
DifficultyEasy Difficulty = "easy"
|
|
DifficultyMedium Difficulty = "medium"
|
|
DifficultyHard Difficulty = "hard"
|
|
)
|
|
|
|
// AuditAction represents an action in the audit trail
|
|
type AuditAction string
|
|
|
|
const (
|
|
AuditActionAssigned AuditAction = "assigned"
|
|
AuditActionStarted AuditAction = "started"
|
|
AuditActionCompleted AuditAction = "completed"
|
|
AuditActionQuizSubmitted AuditAction = "quiz_submitted"
|
|
AuditActionEscalated AuditAction = "escalated"
|
|
AuditActionCertificateIssued AuditAction = "certificate_issued"
|
|
AuditActionContentGenerated AuditAction = "content_generated"
|
|
)
|
|
|
|
// AuditEntityType represents the type of entity in audit log
|
|
type AuditEntityType string
|
|
|
|
const (
|
|
AuditEntityAssignment AuditEntityType = "assignment"
|
|
AuditEntityModule AuditEntityType = "module"
|
|
AuditEntityQuiz AuditEntityType = "quiz"
|
|
AuditEntityCertificate AuditEntityType = "certificate"
|
|
)
|
|
|
|
// ============================================================================
|
|
// Role Constants
|
|
// ============================================================================
|
|
|
|
const (
|
|
RoleR1 = "R1" // Geschaeftsfuehrung
|
|
RoleR2 = "R2" // IT-Leitung
|
|
RoleR3 = "R3" // DSB
|
|
RoleR4 = "R4" // ISB
|
|
RoleR5 = "R5" // HR
|
|
RoleR6 = "R6" // Einkauf
|
|
RoleR7 = "R7" // Fachabteilung
|
|
RoleR8 = "R8" // IT-Admin
|
|
RoleR9 = "R9" // Alle Mitarbeiter
|
|
RoleR10 = "R10" // Behoerden / Oeffentlicher Dienst
|
|
)
|
|
|
|
// RoleLabels maps role codes to human-readable labels
|
|
var RoleLabels = map[string]string{
|
|
RoleR1: "Geschaeftsfuehrung",
|
|
RoleR2: "IT-Leitung",
|
|
RoleR3: "Datenschutzbeauftragter",
|
|
RoleR4: "Informationssicherheitsbeauftragter",
|
|
RoleR5: "HR / Personal",
|
|
RoleR6: "Einkauf / Beschaffung",
|
|
RoleR7: "Fachabteilung",
|
|
RoleR8: "IT-Administration",
|
|
RoleR9: "Alle Mitarbeiter",
|
|
RoleR10: "Behoerden / Oeffentlicher Dienst",
|
|
}
|
|
|
|
// NIS2RoleMapping maps internal roles to NIS2 levels
|
|
var NIS2RoleMapping = map[string]string{
|
|
RoleR1: "N1", // Geschaeftsfuehrung
|
|
RoleR2: "N2", // IT-Leitung
|
|
RoleR3: "N3", // DSB
|
|
RoleR4: "N3", // ISB
|
|
RoleR5: "N4", // HR
|
|
RoleR6: "N4", // Einkauf
|
|
RoleR7: "N5", // Fachabteilung
|
|
RoleR8: "N2", // IT-Admin
|
|
RoleR9: "N5", // Alle Mitarbeiter
|
|
RoleR10: "N4", // Behoerden
|
|
}
|
|
|
|
// TargetAudienceRoleMapping maps canonical control target_audience values to CTM roles
|
|
var TargetAudienceRoleMapping = map[string][]string{
|
|
"enterprise": {RoleR1, RoleR4, RoleR5, RoleR6, RoleR7, RoleR9},
|
|
"authority": {RoleR10},
|
|
"provider": {RoleR2, RoleR8},
|
|
"all": {RoleR1, RoleR2, RoleR3, RoleR4, RoleR5, RoleR6, RoleR7, RoleR8, RoleR9, RoleR10},
|
|
}
|
|
|
|
// CategoryRoleMapping provides additional role hints based on control category
|
|
var CategoryRoleMapping = map[string][]string{
|
|
"encryption": {RoleR2, RoleR8},
|
|
"authentication": {RoleR2, RoleR8, RoleR9},
|
|
"network": {RoleR2, RoleR8},
|
|
"data_protection": {RoleR3, RoleR5, RoleR9},
|
|
"logging": {RoleR2, RoleR4, RoleR8},
|
|
"incident": {RoleR1, RoleR4},
|
|
"continuity": {RoleR1, RoleR2, RoleR4},
|
|
"compliance": {RoleR1, RoleR3, RoleR4},
|
|
"supply_chain": {RoleR6},
|
|
"physical": {RoleR7},
|
|
"personnel": {RoleR5, RoleR9},
|
|
"application": {RoleR8},
|
|
"system": {RoleR2, RoleR8},
|
|
"risk": {RoleR1, RoleR4},
|
|
"governance": {RoleR1, RoleR4},
|
|
"hardware": {RoleR2, RoleR8},
|
|
"identity": {RoleR2, RoleR3, RoleR8},
|
|
}
|