Changeset 418 for binary-improvements2/WebServer/src/WebAPI/AbsWebAPI.cs
- Timestamp:
- Feb 27, 2023, 9:40:12 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/WebServer/src/WebAPI/AbsWebAPI.cs
r410 r418 1 using Webserver.Permissions; 2 1 3 namespace Webserver.WebAPI { 2 4 public abstract class AbsWebAPI { 3 5 public readonly string Name; 4 6 protected readonly Web ParentWeb; 7 8 protected readonly string CachedApiModuleName; 5 9 6 10 protected AbsWebAPI (string _name = null) : this(null, _name) { … … 10 14 Name = _name ?? GetType ().Name; 11 15 ParentWeb = _parentWeb; 16 CachedApiModuleName = $"webapi.{Name}"; 17 RegisterPermissions (); 18 } 19 20 protected virtual void RegisterPermissions () { 21 AdminWebModules.Instance.AddKnownModule ($"webapi.{Name}", DefaultPermissionLevel ()); 12 22 } 13 23 14 24 public abstract void HandleRequest (RequestContext _context); 15 25 26 public virtual bool Authorized (RequestContext _context) { 27 return AdminWebModules.Instance.ModuleAllowedWithLevel (CachedApiModuleName, _context.PermissionLevel); 28 } 29 16 30 public virtual int DefaultPermissionLevel () => 0; 17 31 }
Note:
See TracChangeset
for help on using the changeset viewer.