8000 fixup! feat: add auditing to user routes · coder/coder@2ee711d · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ee711d

Browse files
committed
fixup! feat: add auditing to user routes
1 parent 898ea8e commit 2ee711d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

coderd/audit/request.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,19 @@ func InitRequest[T Auditable](w http.ResponseWriter, p *RequestParams) (*Request
129129
}
130130

131131
err = feats.Audit.Export(ctx, database.AuditLog{
132-
ID: uuid.New(),
133-
Time: database.Now(),
134-
UserID: httpmw.APIKey(p.Request).UserID,
135-
Ip: ip,
136-
UserAgent: p.Request.UserAgent(),
137-
ResourceType: either(req.Old, req.New, ResourceType[T]),
138-
ResourceID: either(req.Old, req.New, ResourceID[T]),
139-
ResourceTarget: either(req.Old, req.New, ResourceTarget[T]),
140-
Action: p.Action,
141-
Diff: diffRaw,
142-
StatusCode: int32(sw.Status),
143-
RequestID: httpmw.RequestID(p.Request),
132+
ID: uuid.New(),
133+
Time: database.Now(),
134+
UserID: httpmw.APIKey(p.Request).UserID,
135+
Ip: ip,
136+
UserAgent: p.Request.UserAgent(),
137+
ResourceType: either(req.Old, req.New, ResourceType[T]),
138+
ResourceID: either(req.Old, req.New, ResourceID[T]),
139+
ResourceTarget: either(req.Old, req.New, ResourceTarget[T]),
140+
Action: p.Action,
141+
Diff: diffRaw,
142+
StatusCode: int32(sw.Status),
143+
RequestID: httpmw.RequestID(p.Request),
144+
AdditionalFields: json.RawMessage("{}"),
144145
})
145146
if err != nil {
146147
p.Log.Error(logCtx, "export audit log", slog.Error(err))

0 commit comments

Comments
 (0)
0