From 9cf400a22ecc5d9e50e4d5befa7ffb198ad0b3d9 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 15 Mar 2022 10:00:42 +1000 Subject: [PATCH 1/4] Don't convert date-looking strings to `DateTime` when deserializing untyped JSON; use `decimal` as the base numeric type for untyped JSON numbers, better matching Seq's internal representation. --- src/Seq.Api/Client/SeqApiClient.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Seq.Api/Client/SeqApiClient.cs b/src/Seq.Api/Client/SeqApiClient.cs index d3565ec..f0b690b 100644 --- a/src/Seq.Api/Client/SeqApiClient.cs +++ b/src/Seq.Api/Client/SeqApiClient.cs @@ -48,7 +48,9 @@ public sealed class SeqApiClient : IDisposable readonly JsonSerializer _serializer = JsonSerializer.Create( new JsonSerializerSettings { - Converters = { new StringEnumConverter(), new LinkCollectionConverter() } + Converters = { new StringEnumConverter(), new LinkCollectionConverter() }, + DateParseHandling = DateParseHandling.None, + FloatParseHandling = FloatParseHandling.Decimal }); /// From 59d24f14455a65d533acb78eb40a26e8f0d078db Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 15 Mar 2022 10:01:10 +1000 Subject: [PATCH 2/4] Add `Permission.Organization`. --- src/Seq.Api/Model/Security/Permission.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Seq.Api/Model/Security/Permission.cs b/src/Seq.Api/Model/Security/Permission.cs index 8da1c61..9ed273e 100644 --- a/src/Seq.Api/Model/Security/Permission.cs +++ b/src/Seq.Api/Model/Security/Permission.cs @@ -56,15 +56,21 @@ public enum Permission Setup, /// - /// Access to settings required for day-to-day operation of Seq, such as users, retention policies, API keys. + /// Access to settings that control data ingestion, storage, dashboarding and alerting. /// Project, /// /// Access to settings and features that interact with, or provide access to, the underlying host server, /// such as app (plug-in) installation, backup settings, cluster configuration, diagnostics, and features - /// relying on outbound network access like package feeds and update checks. + /// relying on outbound network access like package feeds and update checks. This permission is required for + /// configuration of the authentication provider and related settings. /// - System + System, + + /// + /// Create, edit, and delete user accounts, reset local user passwords. + /// + Organization } } From 85ecc6f7360d2649873355b6621de0f5c334542c Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 15 Mar 2022 10:01:28 +1000 Subject: [PATCH 3/4] Expose a text description of user roles. --- src/Seq.Api/Model/Security/RoleEntity.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Seq.Api/Model/Security/RoleEntity.cs b/src/Seq.Api/Model/Security/RoleEntity.cs index 57ad0e8..e8a66e5 100644 --- a/src/Seq.Api/Model/Security/RoleEntity.cs +++ b/src/Seq.Api/Model/Security/RoleEntity.cs @@ -29,6 +29,11 @@ public class RoleEntity : Entity /// /// Permissions granted to users in the role. /// - public HashSet Permissions { get; set; } = new HashSet(); + public HashSet Permissions { get; set; } = new(); + + /// + /// Optionally, an extended description of the role. + /// + public string Description { get; set; } } } From 48bc3764a34567fb614a0c377c76c4fe34da23f4 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 15 Mar 2022 10:03:55 +1000 Subject: [PATCH 4/4] Update API for search history tracking. --- ...rchHistoryItemStatus.cs => SearchHistoryItemAction.cs} | 8 ++++---- src/Seq.Api/Model/Users/SearchHistoryItemPart.cs | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) rename src/Seq.Api/Model/Users/{SearchHistoryItemStatus.cs => SearchHistoryItemAction.cs} (90%) diff --git a/src/Seq.Api/Model/Users/SearchHistoryItemStatus.cs b/src/Seq.Api/Model/Users/SearchHistoryItemAction.cs similarity index 90% rename from src/Seq.Api/Model/Users/SearchHistoryItemStatus.cs rename to src/Seq.Api/Model/Users/SearchHistoryItemAction.cs index 7944494..b374beb 100644 --- a/src/Seq.Api/Model/Users/SearchHistoryItemStatus.cs +++ b/src/Seq.Api/Model/Users/SearchHistoryItemAction.cs @@ -17,7 +17,7 @@ namespace Seq.Api.Model.Users /// /// An operation applied to a search history item. /// - public enum SearchHistoryItemStatus + public enum SearchHistoryItemAction { /// /// The item was used (make it more recent). @@ -28,10 +28,10 @@ public enum SearchHistoryItemStatus /// The item has been pinned. /// Pinned, - + /// - /// The item has been un-pinned. + /// The item has been unpinned. /// - Forgotten + Unpinned } } \ No newline at end of file diff --git a/src/Seq.Api/Model/Users/SearchHistoryItemPart.cs b/src/Seq.Api/Model/Users/SearchHistoryItemPart.cs index 1014a7a..6465910 100644 --- a/src/Seq.Api/Model/Users/SearchHistoryItemPart.cs +++ b/src/Seq.Api/Model/Users/SearchHistoryItemPart.cs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// ReSharper disable ClassNeverInstantiated.Global + namespace Seq.Api.Model.Users { /// @@ -20,13 +22,13 @@ namespace Seq.Api.Model.Users public class SearchHistoryItemPart { /// - /// The filter entered by the user into the filter bar. + /// The search or query entered by the user into the search bar. /// public string Search { get; set; } /// /// Status to apply to the search history item. /// - public SearchHistoryItemStatus Status { get; set; } + public SearchHistoryItemAction Action { get; set; } } }