source: binary-improvements2/MapRendering/Web/Handlers/AbsHandler.cs@ 386

Last change on this file since 386 was 383, checked in by alloc, 2 years ago

Fixed a bunch of warnings

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