add autit event token

This commit is contained in:
stremovsky
2019-12-24 20:58:30 +02:00
parent 0ad5de1170
commit bdd1c28394
2 changed files with 9 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"time"
uuid "github.com/hashicorp/go-uuid"
"go.mongodb.org/mongo-driver/bson"
)
@@ -21,6 +22,7 @@ type auditEvent struct {
Debug string `json:"debug"`
Before string `json:"before"`
After string `json:"after"`
Atoken string `json:"atoken"`
}
func audit(title string, record string, mode string, address string) *auditEvent {
@@ -48,6 +50,8 @@ func (event auditEvent) submit(db dbcon) {
return
}*/
bdoc := bson.M{}
atoken, _ := uuid.GenerateUUID()
bdoc["atoken"] = atoken
bdoc["when"] = event.When
if len(event.Who) > 0 {
bdoc["who"] = event.Who