mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-05-13 10:55:04 +00:00
Add dashboard audit log and configuration management
- Implemented dashboard audit logging with InsertAuditLog, GetRecentAuditLogs, GetAuditLogsByIP, and CleanupOldAuditLogs methods. - Created dashboard configuration management with GetDashboardConfig and SetDashboardConfig methods. - Added new tables for dashboard_audit_log and dashboard_config in both MySQL and SQLite migrations. - Updated CMakeLists to include Crow and ASIO for dashboard server functionality. - Enhanced existing database classes to support new dashboard features, including character, play key, and property management. - Added new methods for retrieving and managing play keys, properties, and pet names. - Updated TestSQLDatabase to include stubs for new dashboard-related methods. - Modified shared and dashboard configuration files for new settings.
This commit is contained in:
@@ -56,6 +56,18 @@ void TestSQLDatabase::UpdateActivityLog(const LWOOBJID characterId, const eActiv
|
||||
|
||||
}
|
||||
|
||||
std::vector<IActivityLog::Entry> TestSQLDatabase::GetRecentActivity(const uint32_t limit) {
|
||||
return {};
|
||||
}
|
||||
|
||||
uint32_t TestSQLDatabase::GetActivityLogCount() {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<IActivityLog::Entry> TestSQLDatabase::GetActivityLogPaginated(uint32_t offset, uint32_t limit, const std::string& orderColumn, const std::string& orderDir) {
|
||||
return {};
|
||||
}
|
||||
|
||||
void TestSQLDatabase::DeleteUgcModelData(const LWOOBJID& modelId) {
|
||||
|
||||
}
|
||||
@@ -192,6 +204,115 @@ void TestSQLDatabase::InsertNewMail(const MailInfo& mail) {
|
||||
|
||||
}
|
||||
|
||||
// PlayKeys (dashboard)
|
||||
std::vector<IPlayKeys::Info> TestSQLDatabase::GetAllPlayKeys() {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<IPlayKeys::Info> TestSQLDatabase::GetPlayKeyById(const uint32_t playkeyId) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<IPlayKeys::Info> TestSQLDatabase::GetPlayKeyByString(const std::string_view key_string) {
|
||||
return {};
|
||||
}
|
||||
|
||||
bool TestSQLDatabase::ConsumePlayKeyUsage(const uint32_t playkeyId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void TestSQLDatabase::CreatePlayKey(const std::string_view key, uint32_t accountId, const std::string_view notes) {
|
||||
}
|
||||
|
||||
void TestSQLDatabase::UpdatePlayKey(const uint32_t playkeyId, uint32_t accountId, bool active, const std::string_view notes) {
|
||||
}
|
||||
|
||||
void TestSQLDatabase::DeletePlayKey(const uint32_t playkeyId) {
|
||||
}
|
||||
|
||||
uint32_t TestSQLDatabase::GetPlayKeyCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Bug reports (dashboard)
|
||||
std::vector<IBugReports::DetailedInfo> TestSQLDatabase::GetAllBugReports() {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<IBugReports::DetailedInfo> TestSQLDatabase::GetUnresolvedBugReports() {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<IBugReports::DetailedInfo> TestSQLDatabase::GetResolvedBugReports() {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<IBugReports::DetailedInfo> TestSQLDatabase::GetBugReportById(const uint64_t reportId) {
|
||||
return {};
|
||||
}
|
||||
|
||||
void TestSQLDatabase::ResolveBugReport(const uint64_t reportId, const uint32_t resolverAccountId, const std::string_view resolutionNotes) {
|
||||
}
|
||||
|
||||
uint32_t TestSQLDatabase::GetBugReportCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t TestSQLDatabase::GetUnresolvedBugReportCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Property moderation (dashboard)
|
||||
std::vector<IProperty::Info> TestSQLDatabase::GetAllProperties() {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<IProperty::Info> TestSQLDatabase::GetPropertiesByApprovalStatus(uint32_t status) {
|
||||
return {};
|
||||
}
|
||||
|
||||
uint32_t TestSQLDatabase::GetPropertyCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t TestSQLDatabase::GetUnapprovedPropertyCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Pet name moderation (dashboard)
|
||||
std::vector<IPetNames::DetailedInfo> TestSQLDatabase::GetAllPetNames() {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<IPetNames::DetailedInfo> TestSQLDatabase::GetPetNamesByStatus(int32_t status) {
|
||||
return {};
|
||||
}
|
||||
|
||||
void TestSQLDatabase::SetPetApprovalStatus(const LWOOBJID& petId, int32_t status) {
|
||||
}
|
||||
|
||||
uint32_t TestSQLDatabase::GetPendingPetNamesCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Character edits (dashboard)
|
||||
void TestSQLDatabase::UpdateCharacterPermissions(const LWOOBJID characterId, const ePermissionMap permissions) {
|
||||
}
|
||||
|
||||
void TestSQLDatabase::SetCharacterNeedsRename(const LWOOBJID characterId, const bool needsRename) {
|
||||
}
|
||||
|
||||
// Account dashboard helpers
|
||||
std::optional<IAccounts::DetailedInfo> TestSQLDatabase::GetAccountById(const uint32_t accountId) {
|
||||
return {};
|
||||
}
|
||||
|
||||
void TestSQLDatabase::UpdateAccountEmail(const uint32_t accountId, const std::string_view email) {
|
||||
}
|
||||
|
||||
void TestSQLDatabase::DeleteAccount(const uint32_t accountId) {
|
||||
}
|
||||
|
||||
void TestSQLDatabase::InsertNewUgcModel(std::stringstream& sd0Data, const uint64_t blueprintId, const uint32_t accountId, const LWOOBJID characterId) {
|
||||
|
||||
}
|
||||
@@ -232,6 +353,14 @@ void TestSQLDatabase::UpdateAccountBan(const uint32_t accountId, const bool bann
|
||||
|
||||
}
|
||||
|
||||
void TestSQLDatabase::UpdateAccountLock(const uint32_t accountId, const bool locked) {
|
||||
|
||||
}
|
||||
|
||||
std::vector<IAccounts::ListInfo> TestSQLDatabase::GetAllAccounts() {
|
||||
return {};
|
||||
}
|
||||
|
||||
void TestSQLDatabase::UpdateAccountPassword(const uint32_t accountId, const std::string_view bcryptpassword) {
|
||||
|
||||
}
|
||||
@@ -300,6 +429,10 @@ void TestSQLDatabase::UpdateAccountGmLevel(const uint32_t accountId, const eGame
|
||||
|
||||
}
|
||||
|
||||
void TestSQLDatabase::UpdateAccountPlayKey(const uint32_t accountId, const uint32_t playKeyId) {
|
||||
|
||||
}
|
||||
|
||||
IObjectIdTracker::Range TestSQLDatabase::GetPersistentIdRange() {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ class TestSQLDatabase : public GameDatabase {
|
||||
void AddFriend(const LWOOBJID playerAccountId, const LWOOBJID friendAccountId) override;
|
||||
void RemoveFriend(const LWOOBJID playerAccountId, const LWOOBJID friendAccountId) override;
|
||||
void UpdateActivityLog(const LWOOBJID characterId, const eActivityType activityType, const LWOMAPID mapId) override;
|
||||
std::vector<IActivityLog::Entry> GetRecentActivity(const uint32_t limit) override;
|
||||
uint32_t GetActivityLogCount() override;
|
||||
std::vector<IActivityLog::Entry> GetActivityLogPaginated(uint32_t offset, uint32_t limit, const std::string& orderColumn, const std::string& orderDir) override;
|
||||
void DeleteUgcModelData(const LWOOBJID& modelId) override;
|
||||
void UpdateUgcModelData(const LWOOBJID& modelId, std::stringstream& lxfml) override;
|
||||
std::vector<IUgc::Model> GetAllUgcModels() override;
|
||||
@@ -35,6 +38,9 @@ class TestSQLDatabase : public GameDatabase {
|
||||
std::string GetCharacterXml(const LWOOBJID accountId) override;
|
||||
void UpdateCharacterXml(const LWOOBJID characterId, const std::string_view lxfml) override;
|
||||
std::optional<IAccounts::Info> GetAccountInfo(const std::string_view username) override;
|
||||
std::vector<IAccounts::ListInfo> GetAllAccounts() override;
|
||||
void UpdateAccountLock(const uint32_t accountId, const bool locked) override;
|
||||
std::vector<IAccounts::SessionInfo> GetAccountSessions(const uint32_t accountId, uint32_t limit = 50) override { return {}; }
|
||||
void InsertNewCharacter(const ICharInfo::Info info) override;
|
||||
void InsertCharacterXml(const LWOOBJID accountId, const std::string_view lxfml) override;
|
||||
std::vector<LWOOBJID> GetAccountCharacterIds(LWOOBJID accountId) override;
|
||||
@@ -58,6 +64,51 @@ class TestSQLDatabase : public GameDatabase {
|
||||
void InsertNewBugReport(const IBugReports::Info& info) override;
|
||||
void InsertCheatDetection(const IPlayerCheatDetections::Info& info) override;
|
||||
void InsertNewMail(const MailInfo& mail) override;
|
||||
|
||||
// PlayKeys (dashboard)
|
||||
std::vector<IPlayKeys::Info> GetAllPlayKeys() override;
|
||||
std::optional<IPlayKeys::Info> GetPlayKeyById(const uint32_t playkeyId) override;
|
||||
void CreatePlayKey(const std::string_view key, uint32_t accountId, const std::string_view notes) override;
|
||||
void UpdatePlayKey(const uint32_t playkeyId, uint32_t accountId, bool active, const std::string_view notes) override;
|
||||
void DeletePlayKey(const uint32_t playkeyId) override;
|
||||
uint32_t GetPlayKeyCount() override;
|
||||
std::optional<IPlayKeys::Info> GetPlayKeyByString(const std::string_view key_string) override;
|
||||
bool ConsumePlayKeyUsage(const uint32_t playkeyId) override;
|
||||
|
||||
// Bug reports (dashboard)
|
||||
std::vector<IBugReports::DetailedInfo> GetAllBugReports() override;
|
||||
std::vector<IBugReports::DetailedInfo> GetUnresolvedBugReports() override;
|
||||
std::vector<IBugReports::DetailedInfo> GetResolvedBugReports() override;
|
||||
std::optional<IBugReports::DetailedInfo> GetBugReportById(const uint64_t reportId) override;
|
||||
void ResolveBugReport(const uint64_t reportId, const uint32_t resolverAccountId, const std::string_view resolutionNotes) override;
|
||||
uint32_t GetBugReportCount() override;
|
||||
uint32_t GetUnresolvedBugReportCount() override;
|
||||
|
||||
// Property moderation (dashboard)
|
||||
std::vector<IProperty::Info> GetAllProperties() override;
|
||||
std::vector<IProperty::Info> GetPropertiesByApprovalStatus(uint32_t status) override;
|
||||
uint32_t GetPropertyCount() override;
|
||||
uint32_t GetUnapprovedPropertyCount() override;
|
||||
|
||||
// Pet name moderation (dashboard)
|
||||
std::vector<IPetNames::DetailedInfo> GetAllPetNames() override;
|
||||
std::vector<IPetNames::DetailedInfo> GetPetNamesByStatus(int32_t status) override;
|
||||
void SetPetApprovalStatus(const LWOOBJID& petId, int32_t status) override;
|
||||
uint32_t GetPendingPetNamesCount() override;
|
||||
|
||||
// Character edits (dashboard)
|
||||
void UpdateCharacterPermissions(const LWOOBJID characterId, const ePermissionMap permissions) override;
|
||||
void SetCharacterNeedsRename(const LWOOBJID characterId, const bool needsRename) override;
|
||||
std::optional<ICharInfo::Stats> GetCharacterStats(const LWOOBJID characterId) override { return {}; }
|
||||
std::vector<ICharInfo::InventoryItem> GetCharacterInventory(const LWOOBJID characterId) override { return {}; }
|
||||
std::vector<ICharInfo::Activity> GetCharacterActivity(const LWOOBJID characterId, uint32_t limit = 50) override { return {}; }
|
||||
void RescueCharacter(const LWOOBJID characterId, uint32_t zoneId) override {}
|
||||
|
||||
// Account dashboard helpers
|
||||
std::optional<IAccounts::DetailedInfo> GetAccountById(const uint32_t accountId) override;
|
||||
void UpdateAccountEmail(const uint32_t accountId, const std::string_view email) override;
|
||||
void DeleteAccount(const uint32_t accountId) override;
|
||||
|
||||
void InsertNewUgcModel(
|
||||
std::stringstream& sd0Data,
|
||||
const uint64_t blueprintId,
|
||||
@@ -70,6 +121,7 @@ class TestSQLDatabase : public GameDatabase {
|
||||
void DeleteMail(const uint64_t mailId) override;
|
||||
void ClaimMailItem(const uint64_t mailId) override;
|
||||
void InsertSlashCommandUsage(const LWOOBJID characterId, const std::string_view command) override;
|
||||
std::vector<ICommandLog::Entry> GetCommandLogs(uint32_t limit = 100) override { return {}; }
|
||||
void UpdateAccountUnmuteTime(const uint32_t accountId, const uint64_t timeToUnmute) override;
|
||||
void UpdateAccountBan(const uint32_t accountId, const bool banned) override;
|
||||
void UpdateAccountPassword(const uint32_t accountId, const std::string_view bcryptpassword) override;
|
||||
@@ -90,6 +142,7 @@ class TestSQLDatabase : public GameDatabase {
|
||||
std::string GetBehavior(const LWOOBJID behaviorId) override;
|
||||
void RemoveBehavior(const LWOOBJID behaviorId) override;
|
||||
void UpdateAccountGmLevel(const uint32_t accountId, const eGameMasterLevel gmLevel) override;
|
||||
void UpdateAccountPlayKey(const uint32_t accountId, const uint32_t playKeyId) override;
|
||||
std::optional<IProperty::PropertyEntranceResult> GetProperties(const IProperty::PropertyLookup& params) override { return {}; };
|
||||
std::vector<ILeaderboard::Entry> GetDescendingLeaderboard(const uint32_t activityId) override { return {}; };
|
||||
std::vector<ILeaderboard::Entry> GetAscendingLeaderboard(const uint32_t activityId) override { return {}; };
|
||||
@@ -103,11 +156,31 @@ class TestSQLDatabase : public GameDatabase {
|
||||
void InsertUgcBuild(const std::string& modules, const LWOOBJID bigId, const std::optional<LWOOBJID> characterId) override {};
|
||||
void DeleteUgcBuild(const LWOOBJID bigId) override {};
|
||||
uint32_t GetAccountCount() override { return 0; };
|
||||
uint32_t GetBannedAccountCount() override { return 0; };
|
||||
uint32_t GetLockedAccountCount() override { return 0; };
|
||||
|
||||
bool IsNameInUse(const std::string_view name) override { return false; };
|
||||
uint32_t GetCharacterCount() override { return 0; };
|
||||
std::vector<ICharInfo::Info> GetAllCharactersPaginated(uint32_t offset, uint32_t limit, const std::string& orderColumn, const std::string& orderDir) override { return {}; };
|
||||
std::vector<ICharInfo::Info> GetCharactersWithPendingNames() override { return {}; };
|
||||
std::optional<IPropertyContents::Model> GetModel(const LWOOBJID modelID) override { return {}; }
|
||||
std::optional<IProperty::Info> GetPropertyInfo(const LWOOBJID id) override { return {}; }
|
||||
std::optional<IUgc::Model> GetUgcModel(const LWOOBJID ugcId) override { return {}; }
|
||||
|
||||
// Dashboard Audit Log
|
||||
void InsertAuditLog(const std::string_view ip_address, const std::string_view endpoint,
|
||||
const std::string_view method, const std::string_view user_agent, int32_t response_code) override {}
|
||||
std::vector<IDashboardAuditLog::AuditLogEntry> GetRecentAuditLogs(uint32_t limit) override { return {}; }
|
||||
std::vector<IDashboardAuditLog::AuditLogEntry> GetAuditLogsByIP(const std::string_view ip_address, uint32_t limit) override { return {}; }
|
||||
void CleanupOldAuditLogs(uint32_t days_to_keep) override {}
|
||||
void InsertAdminActionLog(uint32_t adminAccountId, const std::string_view action,
|
||||
const std::string_view targetType, uint64_t targetId,
|
||||
const std::string_view details) override {}
|
||||
std::vector<IDashboardAuditLog::AdminActionLog> GetAuditLogs(uint32_t limit = 100) override { return {}; }
|
||||
|
||||
// Dashboard Config
|
||||
std::optional<std::string> GetDashboardConfig(const std::string_view config_key) override { return {}; }
|
||||
void SetDashboardConfig(const std::string_view config_key, const std::string_view config_value) override {}
|
||||
};
|
||||
|
||||
#endif //!TESTSQLDATABASE_H
|
||||
|
||||
Reference in New Issue
Block a user