Changeset 454 for binary-improvements/MapRendering/API/GetLandClaims.cs
- Timestamp:
- Jul 28, 2023, 8:42:10 PM (16 months ago)
- Location:
- binary-improvements/MapRendering/API
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/API/GetLandClaims.cs
r453 r454 3 3 using AllocsFixes.JSON; 4 4 using AllocsFixes.PersistentData; 5 using Webserver; 6 using Webserver.Permissions; 7 using Webserver.WebAPI; 5 8 6 namespace AllocsFixes.NetConnections.Servers.Web.API { 7 public class GetLandClaims : WebAPI { 8 public override void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user, 9 int _permissionLevel) { 9 namespace AllocsFixes.WebAPIs { 10 public class GetLandClaims : AbsWebAPI { 11 public override void HandleRequest (RequestContext _context) { 10 12 PlatformUserIdentifierAbs requestedUserId = null; 11 if (_req.QueryString ["userid"] != null) { 12 if (!PlatformUserIdentifierAbs.TryFromCombinedString (_req.QueryString ["userid"], out requestedUserId)) { 13 _resp.StatusCode = (int) HttpStatusCode.BadRequest; 14 Web.SetResponseTextContent (_resp, "Invalid user id given"); 13 if (_context.Request.QueryString ["userid"] != null) { 14 if (!PlatformUserIdentifierAbs.TryFromCombinedString (_context.Request.QueryString ["userid"], out requestedUserId)) { 15 WebUtils.WriteText (_context.Response, "Invalid user id given", HttpStatusCode.BadRequest); 15 16 return; 16 17 } … … 18 19 19 20 // default user, cheap way to avoid 'null reference exception' 20 PlatformUserIdentifierAbs userId = _ user?.UserId;21 PlatformUserIdentifierAbs userId = _context.Connection?.UserId; 21 22 22 bool bViewAll = WebConnection.CanViewAllClaims (_permissionLevel);23 bool bViewAll = PermissionUtils.CanViewAllClaims (_context.PermissionLevel); 23 24 24 25 JSONObject result = new JSONObject (); … … 73 74 } 74 75 75 WriteJSON (_resp, result);76 LegacyApiHelper.WriteJSON (_context.Response, result); 76 77 } 77 78 }
Note:
See TracChangeset
for help on using the changeset viewer.