Last change
on this file since 465 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
|
Rev | Line | |
---|
[404] | 1 | using Webserver.Permissions;
|
---|
| 2 |
|
---|
[391] | 3 | namespace Webserver.UrlHandlers {
|
---|
| 4 | public abstract class AbsHandler {
|
---|
[434] | 5 | public readonly string ModuleName;
|
---|
[391] | 6 | protected string urlBasePath;
|
---|
| 7 | protected Web parent;
|
---|
| 8 |
|
---|
| 9 | public string UrlBasePath => urlBasePath;
|
---|
| 10 |
|
---|
| 11 | protected AbsHandler (string _moduleName, int _defaultPermissionLevel = 0) {
|
---|
[434] | 12 | ModuleName = _moduleName;
|
---|
[426] | 13 | AdminWebModules.Instance.AddKnownModule (new AdminWebModules.WebModule(_moduleName, _defaultPermissionLevel, true));
|
---|
[391] | 14 | }
|
---|
| 15 |
|
---|
| 16 | public abstract void HandleRequest (RequestContext _context);
|
---|
| 17 |
|
---|
[440] | 18 | public virtual bool IsAuthorizedForHandler (RequestContext _context) {
|
---|
| 19 | return ModuleName == null || AdminWebModules.Instance.ModuleAllowedWithLevel (ModuleName, _context.PermissionLevel);
|
---|
[391] | 20 | }
|
---|
| 21 |
|
---|
| 22 | public virtual void Shutdown () {
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | public virtual void SetBasePathAndParent (Web _parent, string _relativePath) {
|
---|
| 26 | parent = _parent;
|
---|
| 27 | urlBasePath = _relativePath;
|
---|
[463] | 28 | parent.OpenApiHelpers.LoadOpenApiSpec (this);
|
---|
[391] | 29 | }
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.