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
RevLine 
[325]1namespace AllocsFixes.NetConnections.Servers.Web.Handlers {
[382]2 public abstract class AbsHandler {
[367]3 protected readonly string moduleName;
4 protected string urlBasePath;
5 protected Web parent;
[244]6
[382]7 public string ModuleName => moduleName;
8 public string UrlBasePath => urlBasePath;
9
10 protected AbsHandler (string _moduleName, int _defaultPermissionLevel = 0) {
[325]11 moduleName = _moduleName;
[279]12 WebPermissions.Instance.AddKnownModule (_moduleName, _defaultPermissionLevel);
[244]13 }
14
[387]15 public abstract void HandleRequest (RequestContext _context);
[325]16
[372]17 public virtual bool IsAuthorizedForHandler (WebConnection _user, int _permissionLevel) {
18 return moduleName == null || WebPermissions.Instance.ModuleAllowedWithLevel (moduleName, _permissionLevel);
[244]19 }
[367]20
21 public virtual void Shutdown () {
22 }
23
24 public virtual void SetBasePathAndParent (Web _parent, string _relativePath) {
25 parent = _parent;
26 urlBasePath = _relativePath;
27 }
[230]28 }
[325]29}
Note: See TracBrowser for help on using the repository browser.