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:
@@ -2,8 +2,11 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/archivmail/internal/audit"
|
||||||
)
|
)
|
||||||
|
|
||||||
// handlePurge deletes all mails whose retention period has expired.
|
// handlePurge deletes all mails whose retention period has expired.
|
||||||
@@ -56,11 +59,14 @@ func (s *Server) handleSetTenantRetention(w http.ResponseWriter, r *http.Request
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
sess := getSession(r)
|
sess := sessionFromCtx(r.Context())
|
||||||
if s.audlog != nil {
|
if s.audlog != nil {
|
||||||
_ = s.audlog.Log(r.Context(), sess.UserID, "tenant_retention_changed", map[string]interface{}{
|
s.audlog.Log(audit.Entry{
|
||||||
"tenant_id": tenantID,
|
EventType: "tenant_retention_changed",
|
||||||
"retention_days": body.RetentionDays,
|
Username: sess.Username,
|
||||||
|
IPAddress: s.remoteIP(r),
|
||||||
|
Success: true,
|
||||||
|
Detail: fmt.Sprintf("tenant_id=%d retention_days=%d", tenantID, body.RetentionDays),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user