mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 03:53:26 -08:00
[Server] Serve account moderation through the database interface (#7849)
The moderator account commands still reached Servatrice_DatabaseInterface through its concrete class: cmdResetUserPassword ran the privilege lookup inline and called the concrete-only changeUserPasswordWithLegacyBackup, while the avatar, banner and blacklisted-banner commands called concrete-only helpers. Promote those four methods to Server_DatabaseInterface, move RemoveUserBannerResult into the interface, and add getUserAdminFlags for the reset privilege lookup. The escalation guard, audit records, had_banner response field and every response code stay in the handler.
This commit is contained in:
parent
f7c6e81347
commit
2608228bdd
4 changed files with 67 additions and 29 deletions
|
|
@ -216,7 +216,7 @@ public:
|
|||
* same password as the downgrade backup for pre-challenge clients. */
|
||||
bool changeUserPasswordWithLegacyBackup(const QString &user,
|
||||
const QString &passwordVerifier,
|
||||
const QString &legacyCredential);
|
||||
const QString &legacyCredential) override;
|
||||
bool changeUserPassword(const QString &user,
|
||||
const QString &oldPassword,
|
||||
bool oldPasswordNeedsHash,
|
||||
|
|
@ -276,19 +276,12 @@ public:
|
|||
// Uptime snapshot as recorded by Servatrice::statusUpdate() into the
|
||||
// {prefix}_uptime table. valid is false when no snapshot exists yet.
|
||||
UptimeSnapshot getLatestUptimeSnapshot(int serverId) override;
|
||||
bool removeUserAvatar(const QString &userName);
|
||||
|
||||
bool removeUserAvatar(const QString &userName) override;
|
||||
// Outcome of removeUserBanner(), so the caller can tell a missing user apart
|
||||
// from a user who simply has no banner card set.
|
||||
enum class RemoveUserBannerResult
|
||||
{
|
||||
Removed,
|
||||
NothingToRemove,
|
||||
NoSuchUser,
|
||||
DatabaseError,
|
||||
};
|
||||
RemoveUserBannerResult removeUserBanner(const QString &userName);
|
||||
int clearBlacklistedBanners();
|
||||
RemoveUserBannerResult removeUserBanner(const QString &userName) override;
|
||||
int clearBlacklistedBanners() override;
|
||||
bool getUserAdminFlags(const QString &userName, int &adminFlags) override;
|
||||
bool isCardArtAllowed(const QString &cardName, const QString &cardProviderId) override;
|
||||
bool addForgotPassword(const QString &user) override;
|
||||
bool removeForgotPassword(const QString &user) override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue