mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-05 04:13:44 +00:00
feat(db): permission_grants, permissions and commands given to one account or character
A new table, permission_grants (MySQL migration 96, SQLite 79), and the IPermissionGrants interface with MySQL, SQLite and TestSQL implementations. A row grants (or with deny, takes away) a dashboard permission, a slash command, a permission category or every command up to a GM level, for one account or one character, with an optional expiry, who granted it and when, and a note. Rows are never deleted: removing one sets revoked_at/revoked_by, so the table is also the history. Nothing reads it yet. Check: both migrations run on a fresh and an existing database; DatabaseParityTests PermissionGrants passes against MariaDB (DLU_TEST_MYSQL_HOST) and SQLite gives the same results. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -214,6 +214,12 @@ class TestSQLDatabase : public GameDatabase {
|
||||
std::vector<AccountNote> GetAccountNotes(uint32_t accountId) override { return {}; }
|
||||
std::optional<AccountNote> GetAccountNote(uint64_t id) override { return {}; }
|
||||
void DeleteAccountNote(uint64_t id) override {}
|
||||
uint64_t InsertPermissionGrant(const Grant& grant) override { return 0; }
|
||||
std::optional<Grant> GetPermissionGrant(uint64_t id) override { return {}; }
|
||||
std::vector<Grant> GetPermissionGrants(const std::string& targetType, int64_t targetId) override { return {}; }
|
||||
std::vector<Grant> GetActivePermissionGrants(uint32_t accountId, int64_t characterId, int64_t now) override { return {}; }
|
||||
std::vector<Grant> GetRecentPermissionGrants(bool activeOnly, int64_t now, uint32_t limit) override { return {}; }
|
||||
bool RevokePermissionGrant(uint64_t id, const std::string& revokedBy, int64_t time) override { return false; }
|
||||
uint64_t InsertApiKey(const ApiKey& key) override { return 0; }
|
||||
std::optional<ApiKey> GetApiKey(uint64_t id) override { return {}; }
|
||||
std::optional<ApiKey> GetApiKeyByHash(const std::string& keyHash) override { return {}; }
|
||||
|
||||
Reference in New Issue
Block a user