Last change
on this file since 406 was 404, checked in by alloc, 22 months ago |
Latest state including reworking to the permissions system
|
File size:
936 bytes
|
Line | |
---|
1 | using Webserver.Permissions;
|
---|
2 |
|
---|
3 | namespace 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.