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

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

A few bits of code cleanup

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