refactor audit code

This commit is contained in:
stremovsky
2019-12-14 22:14:59 +02:00
parent 8633fd4f69
commit fd511813ee
3 changed files with 11 additions and 1 deletions

View File

@@ -53,6 +53,12 @@ func (event auditEvent) submit(db dbcon) {
if len(event.Who) > 0 { if len(event.Who) > 0 {
bdoc["who"] = event.Who bdoc["who"] = event.Who
} }
if len(event.Mode) > 0 {
bdoc["mode"] = event.Mode
}
if len(event.Identity) > 0 {
bdoc["identity"] = event.Identity
}
if len(event.Record) > 0 { if len(event.Record) > 0 {
bdoc["record"] = event.Record bdoc["record"] = event.Record
} }

View File

@@ -746,8 +746,10 @@ func initAudit(db *sql.DB) error {
defer tx.Rollback() defer tx.Rollback()
_, err = tx.Exec(` _, err = tx.Exec(`
CREATE TABLE IF NOT EXISTS audit ( CREATE TABLE IF NOT EXISTS audit (
identity STRING,
record STRING, record STRING,
who STRING, who STRING,
mode STRING,
app STRING, app STRING,
title STRING, title STRING,
status STRING, status STRING,

View File

@@ -86,7 +86,9 @@
<thead> <thead>
<tr> <tr>
<th scope="col" data-field="when" data-formatter="dateFormat">when</th> <th scope="col" data-field="when" data-formatter="dateFormat">when</th>
<th scope="col" data-field="who">Who</th> <th scope="col" data-field="itentity">Identity</th>
<th scope="col" data-field="who">Target</th>
<th scope="col" data-field="mode">Mode</th>
<th scope="col" data-field="app">App</th> <th scope="col" data-field="app">App</th>
<th scope="col" data-field="title">Title</th> <th scope="col" data-field="title">Title</th>
<th scope="col" data-field="status">Status</th> <th scope="col" data-field="status">Status</th>