* Audit logging - new schema added, old schema removed.

* fix linter error by running goimports

* Address review comments

* Address review comments

* Example usage of new audit logging API for the updateUserAuth call

* fixed unit test on auditing updating user record

* Changed the `TestUpdateConfigDiffInAuditRecord` testcase---it failed, because this PR changes how the `meta` field is serialized into the audit log records.

* fix linter error
Этот коммит содержится в:
Ossi Väänänen
2022-07-14 12:19:33 +03:00
коммит произвёл GitHub
родитель 6dc897b04f
Коммит 0c5c74904b
10 изменённых файлов: 239 добавлений и 164 удалений

Просмотреть файл

@@ -1508,13 +1508,15 @@ func updateUserAuth(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
auditRec.AddEventParameter("user_auth", userAuth.Auditable())
if userAuth.AuthData == nil || *userAuth.AuthData == "" || userAuth.AuthService == "" {
c.Err = model.NewAppError("updateUserAuth", "api.user.update_user_auth.invalid_request", nil, "", http.StatusBadRequest)
return
}
if user, err := c.App.GetUser(c.Params.UserId); err == nil {
auditRec.AddMeta("user", user)
auditRec.AddEventPriorState(user)
}
user, err := c.App.UpdateUserAuth(c.Params.UserId, &userAuth)
@@ -1522,6 +1524,7 @@ func updateUserAuth(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = err
return
}
auditRec.AddEventResultState(user)
auditRec.Success()
auditRec.AddMeta("auth_service", user.AuthService)