source: binary-improvements2/WebServer/src/UrlHandlers/AbsHandler.cs@ 403

Last change on this file since 403 was 391, checked in by alloc, 2 years ago

Major refactoring/cleanup

File size: 904 bytes
RevLine 
[391]1namespace Webserver.UrlHandlers {
2 public abstract class AbsHandler {
3 protected readonly string moduleName;
4 protected string urlBasePath;
5 protected Web parent;
6
7 public string ModuleName => moduleName;
8 public string UrlBasePath => urlBasePath;
9
10 protected AbsHandler (string _moduleName, int _defaultPermissionLevel = 0) {
11 moduleName = _moduleName;
12 WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
13 }
14
15 public abstract void HandleRequest (RequestContext _context);
16
17 public virtual bool IsAuthorizedForHandler (WebConnection _user, int _permissionLevel) {
18 return moduleName == null || WebPermissions.Instance.ModuleAllowedWithLevel (moduleName, _permissionLevel);
19 }
20
21 public virtual void Shutdown () {
22 }
23
24 public virtual void SetBasePathAndParent (Web _parent, string _relativePath) {
25 parent = _parent;
26 urlBasePath = _relativePath;
27 }
28 }
29}
Note: See TracBrowser for help on using the repository browser.