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

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