ACmdCommand.cs 1.0 KB

123456789101112131415161718192021222324252627282930
  1. using Content.Server.Administration;
  2. using Content.Server.Administration.Managers;
  3. using Content.Shared.Administration;
  4. using Robust.Shared.Player;
  5. using Robust.Shared.Toolshed;
  6. using Robust.Shared.Toolshed.Syntax;
  7. namespace Content.Server.Toolshed.Commands.AdminDebug;
  8. [ToolshedCommand, AdminCommand(AdminFlags.Debug)]
  9. public sealed class ACmdCommand : ToolshedCommand
  10. {
  11. [Dependency] private readonly IAdminManager _adminManager = default!;
  12. [CommandImplementation("perms")]
  13. public AdminFlags[]? Perms([PipedArgument] CommandSpec command)
  14. {
  15. var res = _adminManager.TryGetCommandFlags(command, out var flags);
  16. if (res)
  17. flags ??= Array.Empty<AdminFlags>();
  18. return flags;
  19. }
  20. [CommandImplementation("caninvoke")]
  21. public bool CanInvoke(IInvocationContext ctx, [PipedArgument] CommandSpec command, ICommonSession player)
  22. {
  23. // Deliberately discard the error.
  24. return ((IPermissionController) _adminManager).CheckInvokable(command, player, out _);
  25. }
  26. }