Changeset 418 for binary-improvements2/WebServer/src/Permissions
- Timestamp:
- Feb 27, 2023, 9:40:12 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/WebServer/src/Permissions/AdminWebModules.cs
r404 r418 41 41 42 42 public void AddModule (string _module, int _permissionLevel) { 43 WebModule p = new WebModule (_module, _permissionLevel );43 WebModule p = new WebModule (_module, _permissionLevel, false); 44 44 lock (this) { 45 45 allModulesList.Clear (); … … 84 84 public readonly string Name; 85 85 public readonly int PermissionLevel; 86 public readonly bool IsDefault; 86 87 87 public WebModule (string _name, int _permissionLevel ) {88 public WebModule (string _name, int _permissionLevel, bool _isDefault) { 88 89 Name = _name; 89 90 PermissionLevel = _permissionLevel; 91 IsDefault = _isDefault; 90 92 } 91 93 … … 116 118 } 117 119 118 _result = new WebModule (name, permissionLevel );120 _result = new WebModule (name, permissionLevel, false); 119 121 return true; 120 122 } … … 139 141 } 140 142 141 WebModule p = new WebModule (_module, _defaultPermission );143 WebModule p = new WebModule (_module, _defaultPermission, true); 142 144 143 145 lock (this) { … … 158 160 159 161 public bool ModuleAllowedWithLevel (string _module, int _level) { 160 WebModule permInfo = GetModule (_module) ;162 WebModule permInfo = GetModule (_module)!.Value; 161 163 return permInfo.PermissionLevel >= _level; 162 164 } 163 165 164 public WebModule GetModule (string _module) {166 public WebModule? GetModule (string _module, bool _returnDefaults = true) { 165 167 if (modules.TryGetValue (_module, out WebModule result)) { 166 168 return result; 169 } 170 171 if (!_returnDefaults) { 172 return null; 167 173 } 168 174 … … 170 176 } 171 177 172 private readonly WebModule defaultModulePermission = new WebModule ("", 0 );178 private readonly WebModule defaultModulePermission = new WebModule ("", 0, true); 173 179 174 180 #endregion
Note:
See TracChangeset
for help on using the changeset viewer.