add missing secretId to audit logs
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -162,6 +162,7 @@ func retrieveSpecifiedSecret(s *models.Secret, c *gin.Context) {
|
|||||||
// Create audit record
|
// Create audit record
|
||||||
a := models.Audit{
|
a := models.Audit{
|
||||||
UserId: UserId,
|
UserId: UserId,
|
||||||
|
SecretId: results[0].SecretId,
|
||||||
EventText: fmt.Sprintf("Retrieved Secret Id %d", results[0].SecretId),
|
EventText: fmt.Sprintf("Retrieved Secret Id %d", results[0].SecretId),
|
||||||
}
|
}
|
||||||
a.AutidLogAdd()
|
a.AutidLogAdd()
|
||||||
|
@@ -147,6 +147,7 @@ func StoreSecret(c *gin.Context) {
|
|||||||
// Create audit record
|
// Create audit record
|
||||||
a := models.Audit{
|
a := models.Audit{
|
||||||
UserId: UserId,
|
UserId: UserId,
|
||||||
|
SecretId: s.SecretId,
|
||||||
EventText: fmt.Sprintf("Created Secret Id %d", s.SecretId),
|
EventText: fmt.Sprintf("Created Secret Id %d", s.SecretId),
|
||||||
}
|
}
|
||||||
a.AutidLogAdd()
|
a.AutidLogAdd()
|
||||||
@@ -255,16 +256,6 @@ func UpdateSecret(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporarily disable because we should be able to figure it out without user specifying
|
|
||||||
/*
|
|
||||||
if input.SafeId == 0 && len(input.SafeName) == 0 {
|
|
||||||
errString := "UpdateSecret no safe specified\n"
|
|
||||||
log.Print(errString)
|
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": errString})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Get userId that we stored in the context earlier
|
// Get userId that we stored in the context earlier
|
||||||
if val, ok := c.Get("user-id"); !ok {
|
if val, ok := c.Get("user-id"); !ok {
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user"})
|
c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user"})
|
||||||
@@ -368,6 +359,7 @@ func UpdateSecret(c *gin.Context) {
|
|||||||
// Create audit record
|
// Create audit record
|
||||||
a := models.Audit{
|
a := models.Audit{
|
||||||
UserId: UserId,
|
UserId: UserId,
|
||||||
|
SecretId: s.SecretId,
|
||||||
EventText: fmt.Sprintf("Updated Secret Id %d", s.SecretId),
|
EventText: fmt.Sprintf("Updated Secret Id %d", s.SecretId),
|
||||||
}
|
}
|
||||||
a.AutidLogAdd()
|
a.AutidLogAdd()
|
||||||
@@ -458,6 +450,7 @@ func DeleteSecret(c *gin.Context) {
|
|||||||
// Create audit record
|
// Create audit record
|
||||||
a := models.Audit{
|
a := models.Audit{
|
||||||
UserId: UserId,
|
UserId: UserId,
|
||||||
|
SecretId: s.SecretId,
|
||||||
EventText: fmt.Sprintf("Deleted Secret Id %d", s.SecretId),
|
EventText: fmt.Sprintf("Deleted Secret Id %d", s.SecretId),
|
||||||
}
|
}
|
||||||
a.AutidLogAdd()
|
a.AutidLogAdd()
|
||||||
|
Reference in New Issue
Block a user