add client IP 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:
12
models/db.go
12
models/db.go
@@ -86,6 +86,7 @@ const createAudit string = `
|
||||
UserId INTEGER DEFAULT 0,
|
||||
SecretId INTEGER DEFAULT 0,
|
||||
EventText VARCHAR,
|
||||
IpAddress VARCHAR,
|
||||
EventTime datetime
|
||||
);
|
||||
`
|
||||
@@ -394,6 +395,17 @@ func CreateTables() {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
// Add IpAddress column to audit table
|
||||
auditIPCheck, _ := CheckColumnExists("audit", "IpAddress")
|
||||
if !auditIPCheck {
|
||||
// Add the column for LdapGroup in the roles table
|
||||
_, err := db.Exec("ALTER TABLE audit ADD COLUMN IpAddress VARCHAR;")
|
||||
if err != nil {
|
||||
log.Printf("Error altering audit table to add IpAddress column : '%s'\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Count the number of records in the sqlite database
|
||||
|
Reference in New Issue
Block a user