Ignore:
Timestamp:
Aug 6, 2022, 11:32:32 PM (2 years ago)
Author:
alloc
Message:

Big refactoring in Web to pass around a Context instead of a bunch of individual arguments all the time

File:
1 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements2/MapRendering/Web/API/GetAllowedCommands.cs

    r383 r387  
    11using AllocsFixes.JSON;
    2 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;
    3 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;
    42
    53namespace AllocsFixes.NetConnections.Servers.Web.API {
    6         public class GetAllowedCommands : WebAPI {
    7                 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
    8                         int _permissionLevel) {
     4        public class GetAllowedCommands : AbsWebAPI {
     5                public override void HandleRequest (RequestContext _context) {
    96                        JSONObject result = new JSONObject ();
    107                        JSONArray entries = new JSONArray ();
    118                        foreach (IConsoleCommand cc in SdtdConsole.Instance.GetCommands ()) {
    129                                int commandPermissionLevel = GameManager.Instance.adminTools.GetCommandPermissionLevel (cc.GetCommands ());
    13                                 if (_permissionLevel <= commandPermissionLevel) {
     10                                if (_context.PermissionLevel <= commandPermissionLevel) {
    1411                                        string cmd = string.Empty;
    1512                                        foreach (string s in cc.GetCommands ()) {
     
    2926                        result.Add ("commands", entries);
    3027
    31                         WriteJSON (_resp, result);
     28                        WebUtils.WriteJson (_context.Response, result);
    3229                }
    3330
Note: See TracChangeset for help on using the changeset viewer.