[MM-56339] Audit logs: on login add UserId and SessionId to audit's Actor field (#27446)
* on login add UserId and SessionId to audit's Actor field to match logout * lint * simplify to add only userId and sessionId * AddToEventActor -> AddUser/SessionToEventActor * fill in missing session data when logging the audit record * why did it bump that? reverting. * make modules-tidy * trigger build * add more context to the comment
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9f312f48b5
Коммит
9b2f20210b
@@ -29,6 +29,15 @@ type Context struct {
|
||||
|
||||
// LogAuditRec logs an audit record using default LevelAPI.
|
||||
func (c *Context) LogAuditRec(rec *audit.Record) {
|
||||
// finish populating the context data, in case the session wasn't available during MakeAuditRecord
|
||||
// (e.g., api4/user.go login)
|
||||
if rec.Actor.UserId == "" {
|
||||
rec.Actor.UserId = c.AppContext.Session().UserId
|
||||
}
|
||||
if rec.Actor.SessionId == "" {
|
||||
rec.Actor.SessionId = c.AppContext.Session().Id
|
||||
}
|
||||
|
||||
c.LogAuditRecWithLevel(rec, app.LevelAPI)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user