source: binary-improvements/MapRendering/Web/WebConnection.cs@ 376

Last change on this file since 376 was 369, checked in by alloc, 3 years ago

Preparations for A20 release
Changes usage of "SteamID" to "UserID" in console commands
Also changes a bunch of the WebAPI stuff to show / use UserIDs

File size: 1.7 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Net;
4using UnityEngine;
5
6namespace AllocsFixes.NetConnections.Servers.Web {
7 public class WebConnection : ConsoleConnectionAbstract {
8 private readonly DateTime login;
9// private readonly List<string> outputLines = new List<string> ();
10 private DateTime lastAction;
11 private readonly string conDescription;
12
13 public WebConnection (string _sessionId, IPAddress _endpoint, PlatformUserIdentifierAbs _userId) {
14 SessionID = _sessionId;
15 Endpoint = _endpoint;
16 UserId = _userId;
17 login = DateTime.Now;
18 lastAction = login;
19 conDescription = "WebPanel from " + Endpoint;
20 }
21
22 public string SessionID { get; }
23
24 public IPAddress Endpoint { get; }
25
26 public PlatformUserIdentifierAbs UserId { get; }
27
28 public TimeSpan Age => DateTime.Now - lastAction;
29
30 public static bool CanViewAllPlayers (int _permissionLevel) {
31 return WebPermissions.Instance.ModuleAllowedWithLevel ("webapi.viewallplayers", _permissionLevel);
32 }
33
34 public static bool CanViewAllClaims (int _permissionLevel) {
35 return WebPermissions.Instance.ModuleAllowedWithLevel ("webapi.viewallclaims", _permissionLevel);
36 }
37
38 public void UpdateUsage () {
39 lastAction = DateTime.Now;
40 }
41
42 public override string GetDescription () {
43 return conDescription;
44 }
45
46 public override void SendLine (string _text) {
47// outputLines.Add (_text);
48 }
49
50 public override void SendLines (List<string> _output) {
51// outputLines.AddRange (_output);
52 }
53
54 public override void SendLog (string _formattedMsg, string _plainMsg, string _trace, LogType _type, DateTime _timestamp, long _uptime) {
55 // Do nothing, handled by LogBuffer
56 }
57 }
58}
Note: See TracBrowser for help on using the repository browser.