Changeset 325 for binary-improvements/MapRendering/Web/WebConnection.cs
- Timestamp:
- Sep 4, 2018, 1:00:48 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/MapRendering/Web/WebConnection.cs
r253 r325 1 1 using System; 2 2 using System.Collections.Generic; 3 using AllocsFixes.NetConnections.Servers.Web;4 3 using UnityEngine; 5 4 6 namespace AllocsFixes.NetConnections.Servers.Web 7 { 5 namespace AllocsFixes.NetConnections.Servers.Web { 8 6 public class WebConnection : ConsoleConnectionAbstract { 9 private string sessionId; 10 private string endpoint; 11 private ulong steamId; 12 private DateTime login; 7 private readonly DateTime login; 8 private readonly List<string> outputLines = new List<string> (); 13 9 private DateTime lastAction; 14 private List<string> outputLines = new List<string> ();10 private readonly string conDescription; 15 11 16 public string SessionID { 17 get { return sessionId; } 12 public WebConnection (string _sessionId, string _endpoint, ulong _steamId) { 13 SessionID = _sessionId; 14 Endpoint = _endpoint; 15 SteamID = _steamId; 16 login = DateTime.Now; 17 lastAction = login; 18 conDescription = "WebPanel from " + Endpoint; 18 19 } 19 20 20 public string Endpoint { 21 get { return endpoint; } 22 } 21 public string SessionID { get; private set; } 23 22 24 public ulong SteamID {25 get { return steamId; } 26 }23 public string Endpoint { get; private set; } 24 25 public ulong SteamID { get; private set; } 27 26 28 27 public TimeSpan Age { … … 30 29 } 31 30 32 33 31 public static bool CanViewAllPlayers (int _permissionLevel) { 32 bool val = false; 34 33 35 36 34 try { 35 const int defaultPermissionLevel = 0; 37 36 38 37 val = _permissionLevel <= defaultPermissionLevel; 39 38 40 foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) 41 if (wap.module.Trim ().ToLower () == "webapi.viewallplayers") 42 val = _permissionLevel <= wap.permissionLevel; 43 } 44 catch { } 39 foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) { 40 if (wap.module.Trim ().ToLower () == "webapi.viewallplayers") { 41 val = _permissionLevel <= wap.permissionLevel; 42 } 43 } 44 } catch { 45 } 45 46 46 47 47 return val; 48 } 48 49 49 50 50 public static bool CanViewAllClaims (int _permissionLevel) { 51 bool val = false; 51 52 52 53 53 try { 54 const int defaultPermissionLevel = 0; 54 55 55 56 val = _permissionLevel <= defaultPermissionLevel; 56 57 57 foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) 58 if (wap.module.Trim ().ToLower () == "webapi.viewallclaims") 59 val = _permissionLevel <= wap.permissionLevel; 60 } 61 catch { } 58 foreach (WebPermissions.WebModulePermission wap in WebPermissions.Instance.GetModules ()) { 59 if (wap.module.Trim ().ToLower () == "webapi.viewallclaims") { 60 val = _permissionLevel <= wap.permissionLevel; 61 } 62 } 63 } catch { 64 } 62 65 63 return val; 64 } 65 66 public WebConnection (string _sessionId, string _endpoint, ulong _steamId) { 67 this.sessionId = _sessionId; 68 this.endpoint = _endpoint; 69 this.steamId = _steamId; 70 this.login = DateTime.Now; 71 this.lastAction = this.login; 66 return val; 72 67 } 73 68 74 69 public void UpdateUsage () { 75 this.lastAction = DateTime.Now;70 lastAction = DateTime.Now; 76 71 } 77 72 78 73 public override string GetDescription () { 79 return "WebPanel from " + endpoint;74 return conDescription; 80 75 } 81 76 … … 91 86 // Do nothing, handled by LogBuffer 92 87 } 93 94 88 } 95 89 } 96
Note:
See TracChangeset
for help on using the changeset viewer.