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

@@ -148,9 +148,10 @@ func StoreSecret(c *gin.Context) {
a := models.Audit{
UserId: UserId,
SecretId: s.SecretId,
IpAddress: c.ClientIP(),
EventText: fmt.Sprintf("Created Secret Id %d", s.SecretId),
}
a.AutidLogAdd()
a.AuditLogAdd()
c.JSON(http.StatusOK, gin.H{"message": "secret stored successfully", "data": models.SecretRestricted(s)})
}
@@ -360,9 +361,10 @@ func UpdateSecret(c *gin.Context) {
a := models.Audit{
UserId: UserId,
SecretId: s.SecretId,
IpAddress: c.ClientIP(),
EventText: fmt.Sprintf("Updated Secret Id %d", s.SecretId),
}
a.AutidLogAdd()
a.AuditLogAdd()
c.JSON(http.StatusOK, gin.H{"message": "secret updated successfully", "data": models.SecretRestricted(s)})
} else {
@@ -451,9 +453,10 @@ func DeleteSecret(c *gin.Context) {
a := models.Audit{
UserId: UserId,
SecretId: s.SecretId,
IpAddress: c.ClientIP(),
EventText: fmt.Sprintf("Deleted Secret Id %d", s.SecretId),
}
a.AutidLogAdd()
a.AuditLogAdd()
c.JSON(http.StatusOK, gin.H{"message": "secret deleted successfully"})
} else {