Class SupportAccountsController
- Namespace
- FishMMO.ControlPanel.Controllers
- Assembly
- FishMMO-ControlPanel.dll
Account search, inspection and moderation for support staff.
[ApiController]
[Route("api/support/accounts")]
public sealed class SupportAccountsController : ControllerBase
- Inheritance
-
SupportAccountsController
- Inherited Members
Remarks
Moderation sits at SupportStepUp rather than at Operator: banning is a game master's daily work, and requiring an administrator for it means the person actually handling the report cannot act. The step-up is what makes that safe — a borrowed unlocked session cannot ban anybody without the authenticator.
Every action here is recorded by AuditActionFilter. Nothing in this file calls an audit method; it assigns to AuditScope only where it knows something the filter cannot.
What is deliberately absent. No password reset: an operator who can set a password can sign in as the player, and SRP exists so that nobody holds a credential they can replay. A player who has lost their password uses the recovery path. No account deletion either — it would take the audit record of that account's history with it.
Constructors
SupportAccountsController(IAccountService, ICharacterService, IAuthTokenService, IWebSessionService, ITwoFactorRecoveryCodeService, IKickRequestService, IAdminAuditService, ISupportTicketService, ITwoFactorResetRequestService, IBetaCodeService, SecurityNoticeService, AuditScope, ILogger<SupportAccountsController>)
public SupportAccountsController(IAccountService accounts, ICharacterService characters, IAuthTokenService authTokens, IWebSessionService webSessions, ITwoFactorRecoveryCodeService recoveryCodes, IKickRequestService kickRequests, IAdminAuditService auditLog, ISupportTicketService tickets, ITwoFactorResetRequestService resetRequests, IBetaCodeService betaCodes, SecurityNoticeService notices, AuditScope audit, ILogger<SupportAccountsController> log)
Parameters
accountsIAccountServicecharactersICharacterServiceauthTokensIAuthTokenServicewebSessionsIWebSessionServicerecoveryCodesITwoFactorRecoveryCodeServicekickRequestsIKickRequestServiceauditLogIAdminAuditServiceticketsISupportTicketServiceresetRequestsITwoFactorResetRequestServicebetaCodesIBetaCodeServicenoticesSecurityNoticeServiceauditAuditScopelogILogger<SupportAccountsController>
Methods
Ban(string, ReasonRequest)
Bans an account: level, game tokens, panel sessions and a kick request, atomically.
[HttpPost("{username}/ban")]
[Authorize(Policy = "Support.StepUp")]
[Audited("account.ban", TargetType = "account", TargetRouteValue = "username")]
public Task<IActionResult> Ban(string username, SupportAccountsController.ReasonRequest request)
Parameters
usernamestringrequestSupportAccountsController.ReasonRequest
Returns
Remarks
All four in one transaction, in the database layer. A half-applied ban leaves the account playing, which is the failure the atomicity exists to prevent — and it is what the Discord bot's ban once did by composing the writes separately; it now calls the same service method.
CancelTwoFactorReset(string, ReasonRequest)
Cancels a pending self-service two-factor reset.
[HttpPost("{username}/2fa-reset/cancel")]
[Authorize(Policy = "Support.StepUp")]
[Audited("account.2fa-reset-cancel", TargetType = "account", TargetRouteValue = "username")]
public Task<IActionResult> CancelTwoFactorReset(string username, SupportAccountsController.ReasonRequest request)
Parameters
usernamestringrequestSupportAccountsController.ReasonRequest
Returns
ClearLockout(string, ReasonRequest)
Lifts both sign-in lockouts on an account.
[HttpPost("{username}/clear-lockout")]
[Authorize(Policy = "Support.StepUp")]
[Audited("account.clear-lockout", TargetType = "account", TargetRouteValue = "username")]
public Task<IActionResult> ClearLockout(string username, SupportAccountsController.ReasonRequest request)
Parameters
usernamestringrequestSupportAccountsController.ReasonRequest
Returns
Remarks
For a player locked out by somebody else guessing at their account. Step-up, like every moderation write, because lifting a lock also lifts the brake on whoever was guessing.
Get(string)
One account, with its characters.
[HttpGet("{username}")]
[Authorize(Policy = "Support")]
public Task<IActionResult> Get(string username)
Parameters
usernamestring
Returns
History(string, long?)
What staff need to weigh a report against an account: its standing, what has been reported about it, what it has reported, and what staff have already done to it.
[HttpGet("{username}/history")]
[Authorize(Policy = "Support")]
public Task<IActionResult> History(string username, long? excludeTicketId = null)
Parameters
Returns
Remarks
A report read in isolation is how the fifth complaint about the same player gets the same warning as the first. This puts the pattern beside the report.
The moderation rows are the audit log, narrowed to this account and its characters. The full log stays Operator-only; a game master reading who banned this player before is doing the job, and reading everyone's actions is not. The actor's address, session and the free-form details are left out for the same reason. Tickets above the reader's tier are filtered in the query, as they are in the queue. Recorded in the audit log, like every staff read.
Kick(string, ReasonRequest)
Asks the game servers to disconnect an account.
[HttpPost("{username}/kick")]
[Authorize(Policy = "Support")]
[Audited("account.kick", TargetType = "account", TargetRouteValue = "username")]
public Task<IActionResult> Kick(string username, SupportAccountsController.ReasonRequest request)
Parameters
usernamestringrequestSupportAccountsController.ReasonRequest
Returns
Remarks
Writes a request; it does not sever a connection. The servers act on it on their next poll, which is also when a character's session lease starts running down.
PendingTwoFactorResets(int, int)
Pending self-service two-factor resets across every account, soonest to take effect first.
[HttpGet("2fa-resets")]
[Authorize(Policy = "Support")]
public Task<IActionResult> PendingTwoFactorResets(int page = 1, int pageSize = 25)
Parameters
Returns
Remarks
A reset about to take effect is the moment somebody should look: if the account holder did not ask for it, staff cancelling it is the last line. Game master readable; recorded like every read.
ResetTwoFactor(string, ReasonRequest)
Clears an account's authenticator and its recovery codes.
[HttpPost("{username}/reset-2fa")]
[Authorize(Policy = "Support.StepUp")]
[Audited("account.reset-2fa", TargetType = "account", TargetRouteValue = "username")]
public Task<IActionResult> ResetTwoFactor(string username, SupportAccountsController.ReasonRequest request)
Parameters
usernamestringrequestSupportAccountsController.ReasonRequest
Returns
Remarks
The most dangerous action here, because it removes a security control rather than applying one: afterwards the account is reachable with the password alone until the player enrols again. It exists because a player who has lost both their authenticator and their recovery codes otherwise has no way back in at all.
RevokeTokens(string, ReasonRequest)
Revokes every game token, forcing re-authentication.
[HttpPost("{username}/revoke-tokens")]
[Authorize(Policy = "Support.StepUp")]
[Audited("account.revoke-tokens", TargetType = "account", TargetRouteValue = "username")]
public Task<IActionResult> RevokeTokens(string username, SupportAccountsController.ReasonRequest request)
Parameters
usernamestringrequestSupportAccountsController.ReasonRequest
Returns
Search(string, byte?, bool, int, int)
Searches accounts by name or email prefix.
[HttpGet]
[Authorize(Policy = "Support")]
public Task<IActionResult> Search(string query, byte? accessLevel, bool includeBanned = true, int page = 1, int pageSize = 25)
Parameters
Returns
ShortenTwoFactorReset(string, ShortenResetRequest)
Brings a pending self-service two-factor reset forward, to now or a chosen earlier time.
[HttpPost("{username}/2fa-reset/shorten")]
[Authorize(Policy = "Support.StepUp")]
[Audited("account.2fa-reset-shorten", TargetType = "account", TargetRouteValue = "username")]
public Task<IActionResult> ShortenTwoFactorReset(string username, SupportAccountsController.ShortenResetRequest request)
Parameters
usernamestringrequestSupportAccountsController.ShortenResetRequest
Returns
Remarks
Removes the protection the waiting period gives, so it is a step-up write with a mandatory reason, and the holder is emailed. Only ever earlier: a longer wait is a cancel and a new request.
Unban(string, ReasonRequest)
Lifts a ban, restoring Player.
[HttpPost("{username}/unban")]
[Authorize(Policy = "Support.StepUp")]
[Audited("account.unban", TargetType = "account", TargetRouteValue = "username")]
public Task<IActionResult> Unban(string username, SupportAccountsController.ReasonRequest request)
Parameters
usernamestringrequestSupportAccountsController.ReasonRequest
Returns
Remarks
The level only. The revoked tokens and sessions stay revoked and are not reissued: a credential that was withdrawn should not come back because a moderation decision was reversed. The player signs in again.