Changeset 440 for TFP-WebServer/WebServer/src
- Timestamp:
- May 24, 2023, 4:53:49 PM (18 months ago)
- Location:
- TFP-WebServer/WebServer/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TFP-WebServer/WebServer/src/Permissions/AdminApiTokens.cs
r404 r440 117 117 } 118 118 119 if (IsCommandlineToken (_name, _secret)) { 120 return 0; 121 } 122 119 123 return int.MaxValue; 124 } 125 126 private bool commandlineChecked; 127 private string commandlineTokenName; 128 private string commandlineTokenSecret; 129 130 private bool IsCommandlineToken (string _name, string _secret) { 131 if (!commandlineChecked) { 132 commandlineTokenName = GameUtils.GetLaunchArgument ("webapitokenname"); 133 commandlineTokenSecret = GameUtils.GetLaunchArgument ("webapitokensecret"); 134 135 commandlineChecked = true; 136 } 137 138 if (string.IsNullOrEmpty (commandlineTokenName) || string.IsNullOrEmpty (commandlineTokenSecret)) { 139 return false; 140 } 141 142 return _name == commandlineTokenName && _secret == commandlineTokenSecret; 120 143 } 121 144 -
TFP-WebServer/WebServer/src/UrlHandlers/AbsHandler.cs
r434 r440 16 16 public abstract void HandleRequest (RequestContext _context); 17 17 18 public virtual bool IsAuthorizedForHandler ( WebConnection _user, int _permissionLevel) {19 return ModuleName == null || AdminWebModules.Instance.ModuleAllowedWithLevel (ModuleName, _ permissionLevel);18 public virtual bool IsAuthorizedForHandler (RequestContext _context) { 19 return ModuleName == null || AdminWebModules.Instance.ModuleAllowedWithLevel (ModuleName, _context.PermissionLevel); 20 20 } 21 21 -
TFP-WebServer/WebServer/src/Web.cs
r434 r440 271 271 } 272 272 273 if (!handler.IsAuthorizedForHandler (_context .Connection, _context.PermissionLevel)) {273 if (!handler.IsAuthorizedForHandler (_context)) { 274 274 _context.Response.StatusCode = (int)HttpStatusCode.Forbidden; 275 275 if (_context.Connection != null) {
Note:
See TracChangeset
for help on using the changeset viewer.