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

Last change on this file since 437 was 434, checked in by alloc, 19 months ago

Added permission management APIs

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