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

Last change on this file since 432 was 426, checked in by alloc, 19 months ago

*Updated web permissions system
*Fixed webpermissions command
*Moved API "webmods" to "mods", also lists non-webmod mods

File size: 973 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 (new AdminWebModules.WebModule(_moduleName, _defaultPermissionLevel, true));
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.