Mono repo -> Master (#22553)
Combines the following repositories into one: https://github.com/mattermost/mattermost-server https://github.com/mattermost/mattermost-webapp https://github.com/mattermost/focalboard https://github.com/mattermost/mattermost-plugin-playbooks
Этот коммит содержится в:
36
server/boards/api/audit.go
Обычный файл
36
server/boards/api/audit.go
Обычный файл
@@ -0,0 +1,36 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/server/boards/model"
|
||||
"github.com/mattermost/mattermost-server/v6/server/boards/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 { //nolint:unparam
|
||||
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
|
||||
}
|
||||
Ссылка в новой задаче
Block a user