mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Server audit table (#2423)
* Creating of server side audit table for auditing actions such as password resets, account registrations and log queries. * Add migration script Add migration script for database * Update database script Update database script to reflect new audit table * Creating of server side audit table for auditing actions such as password resets, account registrations and log queries. * Add migration script Add migration script for database * Update database script Update database script to reflect new audit table * Corrected results column possible value(s). * Fixed migration script. * Added boolean audit logic Added enable/disable audit options Added audit functionality for forgot password * Added registration auditing Added registration auditing * Updated ActivateAccount Function Created clientid variable and used it in preporation for future potential protocol expansion. * Extended activation protocol Added clientid to activation command protocol * Typo correction Fix typo's * Missed type fix Found the infamous E! * Updated database function syntax Updated if/else syntax in db add audit function * Untabify content Untab files changed in PR
This commit is contained in:
parent
3c2063df40
commit
d0088f6a18
10 changed files with 256 additions and 62 deletions
|
|
@ -1218,3 +1218,26 @@ bool Servatrice_DatabaseInterface::validateTableColumnStringData(const QString &
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Servatrice_DatabaseInterface::addAuditRecord(const QString &user, const QString &ipaddress, const QString &clientid, const QString &action, const QString &details, const bool &results = false)
|
||||
{
|
||||
if (!checkSql())
|
||||
return;
|
||||
|
||||
if (!server->getEnableAudit())
|
||||
return;
|
||||
|
||||
if (user.isEmpty() || ipaddress.isEmpty() || clientid.isEmpty() || action.isEmpty())
|
||||
return;
|
||||
|
||||
QSqlQuery *query = prepareQuery("insert into {prefix}_audit (id_server,name,ip_address,clientid,incidentDate,action,results,details) values (:idserver,:username,:ipaddress,:clientid,NOW(),:action,:results,:details)");
|
||||
query->bindValue(":idserver", server->getServerID());
|
||||
query->bindValue(":username", user);
|
||||
query->bindValue(":ipaddress", ipaddress);
|
||||
query->bindValue(":clientid", clientid);
|
||||
query->bindValue(":action", action);
|
||||
query->bindValue(":results", results ? "success" : "fail");
|
||||
|
||||
query->bindValue(":details", details);
|
||||
execSqlQuery(query);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue