mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 03:53:26 -08:00
[Server] Move replay code exchange into the database interface (#7839)
createHashForReplay, cmdReplayGetCode, cmdReplaySubmitCode, cmdReplayDownloadByGameId and cmdGrantReplayAccess still issued their own SQL through Servatrice_DatabaseInterface. Add checkReplayAccess, getReplayName, getReplayHashSource, addReplayAccess, getLatestReplayForGame and grantReplayAccessByName to Server_DatabaseInterface, implement them with the same statements, bind order and response mapping, and let the commands ask the injected interface. Hashing and code parsing stay in the handler; the shared insert is reused by both grant paths.
This commit is contained in:
parent
b2e69d3443
commit
03adbd9787
4 changed files with 181 additions and 103 deletions
|
|
@ -361,6 +361,36 @@ public:
|
|||
{
|
||||
return ReplayWriteResult::Failed;
|
||||
}
|
||||
/** @brief Checks whether a user has an access row for a match's replays. */
|
||||
virtual ReplayAccessResult checkReplayAccess(int /* gameId */, int /* userId */)
|
||||
{
|
||||
return ReplayAccessResult::Failed;
|
||||
}
|
||||
/** @brief Reads the stored name of a match's replay access row. */
|
||||
virtual ReplayAccessResult getReplayName(int /* gameId */, QString & /* replayName */)
|
||||
{
|
||||
return ReplayAccessResult::Failed;
|
||||
}
|
||||
/** @brief Copies the leading bytes of a match's replay files, the input of its share code. */
|
||||
virtual bool getReplayHashSource(int /* gameId */, QByteArray & /* source */)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/** @brief Grants one user access to a match's replays. */
|
||||
virtual bool addReplayAccess(int /* gameId */, int /* userId */, const QString & /* replayName */)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/** @brief Fetches the newest replay file of a game for a download-by-game request. */
|
||||
virtual ReplayAccessResult getLatestReplayForGame(int /* gameId */, int & /* replayId */, QByteArray & /* data */)
|
||||
{
|
||||
return ReplayAccessResult::Failed;
|
||||
}
|
||||
/** @brief Grants a user, resolved by name, access to an existing match's replays. */
|
||||
virtual ReplayWriteResult grantReplayAccessByName(int /* gameId */, const QString & /* userName */)
|
||||
{
|
||||
return ReplayWriteResult::Failed;
|
||||
}
|
||||
/** @brief Append a moderator/admin action to the server audit log. */
|
||||
virtual void addAuditRecord(const QString & /* user */,
|
||||
const QString & /* ipaddress */,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue