Class AdminAccountsController
- Namespace
- FishMMO.ControlPanel.Controllers
- Assembly
- FishMMO-ControlPanel.dll
Administrator actions on an account.
[ApiController]
[Route("api/admin/accounts")]
public sealed class AdminAccountsController : ControllerBase
- Inheritance
-
AdminAccountsController
- Inherited Members
Remarks
One route. Changing an access level is the only account action that needs more than a game master, because it is the only one that can create an operator rather than discipline a player.
Constructors
AdminAccountsController(IAccountService, IWebSessionService, AuditScope, ILogger<AdminAccountsController>)
public AdminAccountsController(IAccountService accounts, IWebSessionService webSessions, AuditScope audit, ILogger<AdminAccountsController> log)
Parameters
accountsIAccountServicewebSessionsIWebSessionServiceauditAuditScopelogILogger<AdminAccountsController>
Methods
SetAccessLevel(string, AccessLevelRequest)
Sets an account's access level.
[HttpPost("{username}/access-level")]
[Authorize(Policy = "Operator.StepUp")]
[Audited("account.access-level", TargetType = "account", TargetRouteValue = "username")]
public Task<IActionResult> SetAccessLevel(string username, AdminAccountsController.AccessLevelRequest request)
Parameters
usernamestringrequestAdminAccountsController.AccessLevelRequest
Returns
Remarks
Three guards, each closing a path from administering to escalating: not your own account, not an account at or above your own, and not granting a level at or above your own. Without the last an administrator can mint administrators, and every ceiling above becomes decorative.
The same rules the in-game /admin access command applies, deliberately: two
surfaces onto one capability must not disagree about who may use it, or the weaker
one becomes the way round the stronger.