diff --git a/controllers/retrieveSecrets.go b/controllers/retrieveSecrets.go index a38c0f9..a2ab45c 100644 --- a/controllers/retrieveSecrets.go +++ b/controllers/retrieveSecrets.go @@ -162,6 +162,7 @@ func retrieveSpecifiedSecret(s *models.Secret, c *gin.Context) { // Create audit record a := models.Audit{ UserId: UserId, + SecretId: results[0].SecretId, EventText: fmt.Sprintf("Retrieved Secret Id %d", results[0].SecretId), } a.AutidLogAdd() diff --git a/controllers/storeSecrets.go b/controllers/storeSecrets.go index 415d2c3..0f20613 100644 --- a/controllers/storeSecrets.go +++ b/controllers/storeSecrets.go @@ -147,6 +147,7 @@ func StoreSecret(c *gin.Context) { // Create audit record a := models.Audit{ UserId: UserId, + SecretId: s.SecretId, EventText: fmt.Sprintf("Created Secret Id %d", s.SecretId), } a.AutidLogAdd() @@ -255,16 +256,6 @@ func UpdateSecret(c *gin.Context) { 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 if val, ok := c.Get("user-id"); !ok { c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user"}) @@ -368,6 +359,7 @@ func UpdateSecret(c *gin.Context) { // Create audit record a := models.Audit{ UserId: UserId, + SecretId: s.SecretId, EventText: fmt.Sprintf("Updated Secret Id %d", s.SecretId), } a.AutidLogAdd() @@ -458,6 +450,7 @@ func DeleteSecret(c *gin.Context) { // Create audit record a := models.Audit{ UserId: UserId, + SecretId: s.SecretId, EventText: fmt.Sprintf("Deleted Secret Id %d", s.SecretId), } a.AutidLogAdd()