diff --git a/Content.Server/_White/Commands/ForceDeadminCommand.cs b/Content.Server/_White/Commands/ForceDeadminCommand.cs new file mode 100644 index 0000000000..dc8cf23128 --- /dev/null +++ b/Content.Server/_White/Commands/ForceDeadminCommand.cs @@ -0,0 +1,44 @@ +using Content.Server.Administration; +using Content.Server.Administration.Managers; +using Content.Shared.Administration; +using JetBrains.Annotations; +using Robust.Server.Player; +using Robust.Shared.Console; + +namespace Content.Server._White.Commands; + +[UsedImplicitly] +[AdminCommand(AdminFlags.Permissions)] +public sealed class ForceDeadminCommand : IConsoleCommand +{ + public string Command => "forcedeadmin"; + public string Description => "Forces someone to deadmin."; + public string Help => "forcedeadmin "; + public void Execute(IConsoleShell shell, string argStr, string[] args) + { + if (args.Length < 1) + { + shell.WriteLine("Didn't specify player."); + return; + } + + var ckey = args[0]; + var playerManager = IoCManager.Resolve(); + + if (!playerManager.TryGetSessionByUsername(ckey, out var player)) + { + shell.WriteLine($"Couldn't find player {ckey}"); + return; + } + + var mgr = IoCManager.Resolve(); + mgr.DeAdmin(player); + + shell.WriteLine($"Deadmined {ckey}"); + } + + public CompletionResult GetCompletion(IConsoleShell shell, string[] args) + { + return args.Length == 1 ? CompletionResult.FromHintOptions(CompletionHelper.SessionNames(), "") : CompletionResult.Empty; + } +} diff --git a/Content.Server/_White/PandaSocket/Commands/PandaBanCommand.cs b/Content.Server/_White/PandaSocket/Commands/PandaBanCommand.cs index ddbda4080f..92e4d7e091 100644 --- a/Content.Server/_White/PandaSocket/Commands/PandaBanCommand.cs +++ b/Content.Server/_White/PandaSocket/Commands/PandaBanCommand.cs @@ -46,6 +46,12 @@ public sealed class PandaBanCommand : IPandaCommand var minutes = (uint) message.Duration!; var isGlobalBan = (bool) message.Global!; + if (Enum.TryParse(message.Severity!, ignoreCase: true, out NoteSeverity severity)) + { + UtkaSendResponse(context, false); + return; + } + var located = await locator.LookupIdByNameOrIdAsync(target); if (located == null) { @@ -101,7 +107,7 @@ public sealed class PandaBanCommand : IPandaCommand roundId, playtime, reason, - NoteSeverity.High, + severity, player, null, serverName); diff --git a/Content.Server/_White/PandaSocket/Main/PandaCommunication.cs b/Content.Server/_White/PandaSocket/Main/PandaCommunication.cs index 344bb0b9ae..b92c699249 100644 --- a/Content.Server/_White/PandaSocket/Main/PandaCommunication.cs +++ b/Content.Server/_White/PandaSocket/Main/PandaCommunication.cs @@ -141,6 +141,9 @@ public sealed class UtkaBanRequest : PandaBaseRequestEventMessage [JsonPropertyName("global")] public bool? Global { get; set; } + + [JsonPropertyName("severity")] + public string? Severity { get; set; } } public sealed class UtkaBanResponse : PandaBaseMessage