Last change
on this file since 463 was 463, checked in by alloc, 15 months ago |
21.1.16.0 release
Completed OpenAPI specs
Add support to path handlers to register OpenAPI specs
Fixed ItemIconHandler throwing error when requested path contains no dot
|
File size:
967 bytes
|
Line | |
---|
1 | using Webserver.Permissions;
|
---|
2 |
|
---|
3 | namespace 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 (RequestContext _context) {
|
---|
19 | return ModuleName == null || AdminWebModules.Instance.ModuleAllowedWithLevel (ModuleName, _context.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 | parent.OpenApiHelpers.LoadOpenApiSpec (this);
|
---|
29 | }
|
---|
30 | }
|
---|
31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.