- Timestamp:
- Aug 6, 2022, 11:32:32 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/MapRendering/Web/API/GetLandClaims.cs
r382 r387 3 3 using AllocsFixes.JSON; 4 4 using AllocsFixes.PersistentData; 5 using HttpListenerRequest = SpaceWizards.HttpListener.HttpListenerRequest;6 using HttpListenerResponse = SpaceWizards.HttpListener.HttpListenerResponse;7 5 8 6 namespace AllocsFixes.NetConnections.Servers.Web.API { 9 public class GetLandClaims : WebAPI { 10 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user, 11 int _permissionLevel) { 7 public class GetLandClaims : AbsWebAPI { 8 public override void HandleRequest (RequestContext _context) { 12 9 PlatformUserIdentifierAbs requestedUserId = null; 13 if (_req.QueryString ["userid"] != null) { 14 if (!PlatformUserIdentifierAbs.TryFromCombinedString (_req.QueryString ["userid"], out requestedUserId)) { 15 _resp.StatusCode = (int) HttpStatusCode.BadRequest; 16 Web.SetResponseTextContent (_resp, "Invalid user id given"); 10 if (_context.Request.QueryString ["userid"] != null) { 11 if (!PlatformUserIdentifierAbs.TryFromCombinedString (_context.Request.QueryString ["userid"], out requestedUserId)) { 12 WebUtils.WriteText (_context.Response, "Invalid user id given", HttpStatusCode.BadRequest); 17 13 return; 18 14 } … … 20 16 21 17 // default user, cheap way to avoid 'null reference exception' 22 PlatformUserIdentifierAbs userId = _ user?.UserId;18 PlatformUserIdentifierAbs userId = _context.Connection?.UserId; 23 19 24 bool bViewAll = WebConnection.CanViewAllClaims (_ permissionLevel);20 bool bViewAll = WebConnection.CanViewAllClaims (_context.PermissionLevel); 25 21 26 22 JSONObject result = new JSONObject (); … … 74 70 } 75 71 76 W riteJSON (_resp, result);72 WebUtils.WriteJson (_context.Response, result); 77 73 } 78 74 }
Note:
See TracChangeset
for help on using the changeset viewer.