feature: RBAC + Clinical Audit Logging

This commit is contained in:
voltsrage
2026-06-21 15:46:55 +08:00
parent a43db52813
commit 5af6ab490e
83 changed files with 4281 additions and 70 deletions
@@ -0,0 +1,40 @@
public enum AuditAction
{
ThresholdCreated,
ThresholdUpdated,
AlertAcknowledged,
AlertResolved,
EncounterStatusChanged,
PatientRegistered,
SuppressionWindowSet,
UserLogin
}
public static class AuditActionExtensions
{
public static string ToDbString(this AuditAction a) => a switch
{
AuditAction.ThresholdCreated => "THRESHOLD_CREATED",
AuditAction.ThresholdUpdated => "THRESHOLD_UPDATED",
AuditAction.AlertAcknowledged => "ALERT_ACKNOWLEDGED",
AuditAction.AlertResolved => "ALERT_RESOLVED",
AuditAction.EncounterStatusChanged => "ENCOUNTER_STATUS_CHANGED",
AuditAction.PatientRegistered => "PATIENT_REGISTERED",
AuditAction.SuppressionWindowSet => "SUPPRESSION_WINDOW_SET",
AuditAction.UserLogin => "USER_LOGIN",
_ => throw new ArgumentOutOfRangeException(nameof(a))
};
public static AuditAction FromDbString(string v) => v switch
{
"THRESHOLD_CREATED" => AuditAction.ThresholdCreated,
"THRESHOLD_UPDATED" => AuditAction.ThresholdUpdated,
"ALERT_ACKNOWLEDGED" => AuditAction.AlertAcknowledged,
"ALERT_RESOLVED" => AuditAction.AlertResolved,
"ENCOUNTER_STATUS_CHANGED" => AuditAction.EncounterStatusChanged,
"PATIENT_REGISTERED" => AuditAction.PatientRegistered,
"SUPPRESSION_WINDOW_SET" => AuditAction.SuppressionWindowSet,
"USER_LOGIN" => AuditAction.UserLogin,
_ => throw new ArgumentOutOfRangeException(nameof(v))
};
}