mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
13552b126e
This reverts commit 2d0dde21dd
.
Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
34 lines
811 B
Go
34 lines
811 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/mattermost/focalboard/server/model"
|
|
"github.com/mattermost/focalboard/server/services/audit"
|
|
)
|
|
|
|
// makeAuditRecord creates an audit record pre-populated with data from the request.
|
|
func (a *API) makeAuditRecord(r *http.Request, event string, initialStatus string) *audit.Record {
|
|
ctx := r.Context()
|
|
var sessionID string
|
|
var userID string
|
|
if session, ok := ctx.Value(sessionContextKey).(*model.Session); ok {
|
|
sessionID = session.ID
|
|
userID = session.UserID
|
|
}
|
|
|
|
teamID := "unknown"
|
|
rec := &audit.Record{
|
|
APIPath: r.URL.Path,
|
|
Event: event,
|
|
Status: initialStatus,
|
|
UserID: userID,
|
|
SessionID: sessionID,
|
|
Client: r.UserAgent(),
|
|
IPAddress: r.RemoteAddr,
|
|
Meta: []audit.Meta{{K: audit.KeyTeamID, V: teamID}},
|
|
}
|
|
|
|
return rec
|
|
}
|