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

Last change on this file since 424 was 372, checked in by alloc, 2 years ago

A few bits of code cleanup

File size: 982 bytes
RevLine 
[230]1using System.Net;
2
[325]3namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
4 public abstract class PathHandler {
[367]5 protected readonly string moduleName;
6 protected string urlBasePath;
7 protected Web parent;
[244]8
[279]9 protected PathHandler (string _moduleName, int _defaultPermissionLevel = 0) {
[325]10 moduleName = _moduleName;
[279]11 WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
[244]12 }
13
[372]14 public string ModuleName => moduleName;
[244]15
[351]16 public abstract void HandleRequest (HttpListenerRequest _req, HttpListenerResponse _resp, WebConnection _user,
17 int _permissionLevel);
[325]18
[372]19 public virtual bool IsAuthorizedForHandler (WebConnection _user, int _permissionLevel) {
20 return moduleName == null || WebPermissions.Instance.ModuleAllowedWithLevel (moduleName, _permissionLevel);
[244]21 }
[367]22
23 public virtual void Shutdown () {
24 }
25
26 public virtual void SetBasePathAndParent (Web _parent, string _relativePath) {
27 parent = _parent;
28 urlBasePath = _relativePath;
29 }
[230]30 }
[325]31}
Note: See TracBrowser for help on using the repository browser.