add client IP to audit logs
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-19 10:56:37 +11:00
parent 317e0ab83d
commit 8799f0f796
6 changed files with 32 additions and 12 deletions

View File

@@ -80,9 +80,10 @@ func DeleteUser(c *gin.Context) {
// Create audit record
a := models.Audit{
UserId: RequestingUserId,
IpAddress: c.ClientIP(),
EventText: fmt.Sprintf("Deleted User Id %d", testUser.UserId),
}
a.AutidLogAdd()
a.AuditLogAdd()
c.JSON(http.StatusOK, gin.H{"message": "user deletion success"})
}
@@ -181,9 +182,10 @@ func AddUser(c *gin.Context) {
// Create audit record
a := models.Audit{
UserId: RequestingUserId,
IpAddress: c.ClientIP(),
EventText: fmt.Sprintf("Created User Id %d", u.UserId),
}
a.AutidLogAdd()
a.AuditLogAdd()
c.JSON(http.StatusOK, gin.H{"message": "user registration success", "data": u})
}