Class ServersController
- Namespace
- FishMMO.ControlPanel.Controllers
- Assembly
- FishMMO-ControlPanel.dll
The server board, and per-server lock and shutdown control.
[ApiController]
[Route("api/servers")]
public sealed class ServersController : ControllerBase
- Inheritance
-
ServersController
- Inherited Members
Remarks
Every control here writes a database row. Nothing reaches into a process. Each server adopts its own row on its next pulse, which is what lets a command issued here reach a machine the panel cannot address — and it is why every acknowledgement says what was written rather than claiming the server has already done it. An operator who believes a world is locked when the row has not been read yet will let the next player in and not understand why.
There is no start, stop or restart, and there cannot be one here. A stopped process polls nothing, so no row will ever reach it. Those need a supervising daemon on each host, which is a separate component with its own trust boundary; pretending otherwise with a button that writes a row nobody reads would be the worst kind of control panel lie.
The same capability exists in-game as /admin lockserver and /admin shutdown,
at Admin. These sit at Operator plus a step-up so the two surfaces agree about who may
use them: two faces of one capability that disagree means the weaker is the way around
the stronger.
Constructors
ServersController(IServerBoardService, IWorldServerService, ISceneServerService, AuditScope, ILogger<ServersController>)
public ServersController(IServerBoardService board, IWorldServerService worldServers, ISceneServerService sceneServers, AuditScope audit, ILogger<ServersController> log)
Parameters
boardIServerBoardServiceworldServersIWorldServerServicesceneServersISceneServerServiceauditAuditScopelogILogger<ServersController>
Methods
Board()
Every server, in one read.
[HttpGet]
[Authorize(Policy = "Operator")]
public Task<IActionResult> Board()
Returns
CancelShutdown(string, long, ReasonRequest)
Cancels a scheduled shutdown.
[HttpDelete("{kind}/{id:long}/shutdown")]
[Authorize(Policy = "Operator.StepUp")]
[Audited("server.shutdown-cancel", TargetType = "server", TargetRouteValue = "id")]
public Task<IActionResult> CancelShutdown(string kind, long id, ServersController.ReasonRequest request)
Parameters
kindstringidlongrequestServersController.ReasonRequest
Returns
Lock(string, long, ReasonRequest)
Refuses new logins above Player on one server.
[HttpPost("{kind}/{id:long}/lock")]
[Authorize(Policy = "Operator.StepUp")]
[Audited("server.lock", TargetType = "server", TargetRouteValue = "id")]
public Task<IActionResult> Lock(string kind, long id, ServersController.ReasonRequest request)
Parameters
kindstringidlongrequestServersController.ReasonRequest
Returns
Scenes(int?, long?, int, int)
Live scene instances.
[HttpGet("scenes")]
[Authorize(Policy = "Operator")]
public Task<IActionResult> Scenes(int? status, long? sceneServerId, int page = 1, int pageSize = 50)
Parameters
Returns
Shutdown(string, long, ShutdownRequest)
Schedules a shutdown.
[HttpPost("{kind}/{id:long}/shutdown")]
[Authorize(Policy = "Operator.StepUp")]
[Audited("server.shutdown", TargetType = "server", TargetRouteValue = "id")]
public Task<IActionResult> Shutdown(string kind, long id, ServersController.ShutdownRequest request)
Parameters
kindstringidlongrequestServersController.ShutdownRequest
Returns
Unlock(string, long, ReasonRequest)
Accepts logins again.
[HttpPost("{kind}/{id:long}/unlock")]
[Authorize(Policy = "Operator.StepUp")]
[Audited("server.unlock", TargetType = "server", TargetRouteValue = "id")]
public Task<IActionResult> Unlock(string kind, long id, ServersController.ReasonRequest request)
Parameters
kindstringidlongrequestServersController.ReasonRequest