source: binary-improvements/MapRendering/Web/Handlers/PathHandler.cs@ 364

Last change on this file since 364 was 351, checked in by alloc, 6 years ago

Fixed game version compatibility of GamePrefs
Code style cleanup (mostly argument names)

File size: 787 bytes
Line 
1using System.Net;
2
3namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
4 public abstract class PathHandler {
5 private readonly string moduleName;
6
7 protected PathHandler (string _moduleName, int _defaultPermissionLevel = 0) {
8 moduleName = _moduleName;
9 WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
10 }
11
12 public string ModuleName {
13 get { return moduleName; }
14 }
15
16 public abstract void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
17 int _permissionLevel);
18
19 public bool IsAuthorizedForHandler (WebConnection _user, int _permissionLevel) {
20 if (moduleName != null) {
21 return WebPermissions.Instance.ModuleAllowedWithLevel (moduleName, _permissionLevel);
22 }
23
24 return true;
25 }
26 }
27}
Note: See TracBrowser for help on using the repository browser.