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

Last change on this file since 389 was 387, checked in by alloc, 2 years ago

Big refactoring in Web to pass around a Context instead of a bunch of individual arguments all the time

File size: 930 bytes
Line 
1namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
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.