- Timestamp:
- Feb 27, 2023, 9:40:12 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/WebServer/src/UrlHandlers/ApiHandler.cs
r404 r418 3 3 using System.Net; 4 4 using System.Reflection; 5 using Webserver.Permissions;6 5 using Webserver.WebAPI; 7 6 … … 47 46 private void addApi (AbsWebAPI _api) { 48 47 apis.Add (_api.Name, _api); 49 AdminWebModules.Instance.AddKnownModule ($"webapi.{_api.Name}", _api.DefaultPermissionLevel ());50 48 } 51 49 … … 71 69 } 72 70 73 if (!IsAuthorizedForApi (apiName, _context.PermissionLevel)) { 71 _context.RequestPath = subPath; 72 73 if (!api.Authorized (_context)) { 74 74 _context.Response.StatusCode = (int) HttpStatusCode.Forbidden; 75 75 if (_context.Connection != null) { … … 79 79 return; 80 80 } 81 82 _context.RequestPath = subPath;83 81 84 82 try { … … 92 90 } 93 91 } 94 95 private bool IsAuthorizedForApi (string _apiName, int _permissionLevel) {96 return AdminWebModules.Instance.ModuleAllowedWithLevel ($"webapi.{_apiName}", _permissionLevel);97 }98 92 } 99 93 }
Note:
See TracChangeset
for help on using the changeset viewer.