source: binary-improvements2/MapRendering/src/Api/Map.cs@ 431

Last change on this file since 431 was 426, checked in by alloc, 19 months ago

*Updated web permissions system
*Fixed webpermissions command
*Moved API "webmods" to "mods", also lists non-webmod mods

File size: 1.1 KB
RevLine 
[425]1using System.Net;
2using JetBrains.Annotations;
3using Utf8Json;
4using Webserver;
[426]5using Webserver.Permissions;
[425]6using Webserver.WebAPI;
7
8namespace MapRendering.Api {
9 [UsedImplicitly]
10 public class Map : AbsRestApi {
11
12 private static readonly byte[] jsonEnabledKey = JsonWriter.GetEncodedPropertyNameWithBeginObject ("enabled");
13
14 protected override void HandleRestGet (RequestContext _context) {
15 string id = _context.RequestPath;
16
17 PrepareEnvelopedResult (out JsonWriter writer);
18
19 switch (id) {
20 case "config":
21 writer.WriteRaw (jsonEnabledKey);
22 writer.WriteBoolean (MapRenderer.Enabled);
23 writer.WriteEndObject ();
24 break;
25 default:
26 SendErrorResult (_context, HttpStatusCode.NotImplemented, _errorCode: "INVALID_ID");
27 return;
28 }
29
30 SendEnvelopedResult (_context, ref writer);
31 }
32
[426]33 public override int[] DefaultMethodPermissionLevels () => new[] {
34 AdminWebModules.MethodLevelNotSupported,
35 AdminWebModules.PermissionLevelGuest,
36 AdminWebModules.MethodLevelInheritGlobal,
37 AdminWebModules.MethodLevelInheritGlobal,
38 AdminWebModules.MethodLevelInheritGlobal
39 };
[425]40 }
41}
Note: See TracBrowser for help on using the repository browser.