- Timestamp:
- Feb 16, 2023, 3:50:53 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements2/WebServer/src/UrlHandlers/UserStatusHandler.cs
r402 r404 1 using System.Collections.Generic; 1 2 using Utf8Json; 3 using Webserver.Permissions; 2 4 3 5 namespace Webserver.UrlHandlers { … … 8 10 private static readonly byte[] jsonLoggedInKey = JsonWriter.GetEncodedPropertyNameWithBeginObject ("loggedIn"); 9 11 private static readonly byte[] jsonUsernameKey = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("username"); 12 private static readonly byte[] jsonPermissionLevelKey = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("permissionLevel"); 10 13 private static readonly byte[] jsonPermissionsKey = JsonWriter.GetEncodedPropertyNameWithPrefixValueSeparator ("permissions"); 11 14 … … 20 23 21 24 writer.WriteRaw (jsonUsernameKey); 22 writer.WriteString (_context.Connection != null ? _context.Connection.UserId.ToString () : string.Empty); 25 writer.WriteString (_context.Connection != null ? _context.Connection.Username : string.Empty); 26 27 writer.WriteRaw (jsonPermissionLevelKey); 28 writer.WriteInt32 (_context.PermissionLevel); 23 29 24 30 writer.WriteRaw (jsonPermissionsKey); 25 31 writer.WriteBeginArray (); 26 32 27 bool first = true; 28 foreach (WebPermissions.WebModulePermission perm in WebPermissions.Instance.GetModules ()) { 29 if (!first) { 33 List<AdminWebModules.WebModule> list = AdminWebModules.Instance.GetModules (); 34 for (int i = 0; i < list.Count; i++) { 35 AdminWebModules.WebModule perm = list [i]; 36 37 if (i > 0) { 30 38 writer.WriteValueSeparator (); 31 39 } 32 40 33 first = false;34 35 41 writer.WriteRaw (jsonModuleKey); 36 writer.WriteString (perm. module);37 42 writer.WriteString (perm.Name); 43 38 44 writer.WriteRaw (jsonAllowedKey); 39 writer.WriteBoolean (perm. permissionLevel >= _context.PermissionLevel);40 45 writer.WriteBoolean (perm.PermissionLevel >= _context.PermissionLevel); 46 41 47 writer.WriteEndObject (); 42 48 }
Note:
See TracChangeset
for help on using the changeset viewer.