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

Last change on this file since 425 was 404, checked in by alloc, 21 months ago

Latest state including reworking to the permissions system

File size: 936 bytes
Line 
1using Webserver.Permissions;
2
3namespace Webserver.UrlHandlers {
4 public abstract class AbsHandler {
5 protected readonly string moduleName;
6 protected string urlBasePath;
7 protected Web parent;
8
9 public string ModuleName => moduleName;
10 public string UrlBasePath => urlBasePath;
11
12 protected AbsHandler (string _moduleName, int _defaultPermissionLevel = 0) {
13 moduleName = _moduleName;
14 AdminWebModules.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
15 }
16
17 public abstract void HandleRequest (RequestContext _context);
18
19 public virtual bool IsAuthorizedForHandler (WebConnection _user, int _permissionLevel) {
20 return moduleName == null || AdminWebModules.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.