fix: retention_handlers.go — getSession/audlog.Log-Signatur korrigiert

Ersetzt nicht-existente getSession(r) durch sessionFromCtx(r.Context()) und
passt den audlog.Log-Aufruf auf die korrekte audit.Entry-Struct-Signatur an.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sysops
2026-03-31 10:47:18 +02:00
parent 58bcfb1586
commit 4aadf7a4d2
+10 -4
View File
@@ -2,8 +2,11 @@ package api
import (
"encoding/json"
"fmt"
"net/http"
"strconv"
"github.com/archivmail/internal/audit"
)
// handlePurge deletes all mails whose retention period has expired.
@@ -56,11 +59,14 @@ func (s *Server) handleSetTenantRetention(w http.ResponseWriter, r *http.Request
return
}
sess := getSession(r)
sess := sessionFromCtx(r.Context())
if s.audlog != nil {
_ = s.audlog.Log(r.Context(), sess.UserID, "tenant_retention_changed", map[string]interface{}{
"tenant_id": tenantID,
"retention_days": body.RetentionDays,
s.audlog.Log(audit.Entry{
EventType: "tenant_retention_changed",
Username: sess.Username,
IPAddress: s.remoteIP(r),
Success: true,
Detail: fmt.Sprintf("tenant_id=%d retention_days=%d", tenantID, body.RetentionDays),
})
}