1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 09:32:48 -05:00

[PM-214] Extend Reference Events (#2926)

* Extend ReferenceEvents

Add ClientId and ClientVersion
Modify all callsites to pass in currentContext if available to fill ClientId and ClientVersion

* Extend ReferenceEvent to save if Send has notes
This commit is contained in:
Daniel James Smith
2023-05-16 16:21:57 +02:00
committed by GitHub
parent bfd3f85bb0
commit 12f21b0c33
10 changed files with 57 additions and 31 deletions

View File

@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using Bit.Core.Context;
using Bit.Core.Enums;
using Bit.Core.Tools.Entities;
using Bit.Core.Tools.Enums;
@ -9,7 +10,7 @@ public class ReferenceEvent
{
public ReferenceEvent() { }
public ReferenceEvent(ReferenceEventType type, IReferenceable source)
public ReferenceEvent(ReferenceEventType type, IReferenceable source, ICurrentContext currentContext)
{
Type = type;
if (source != null)
@ -18,6 +19,11 @@ public class ReferenceEvent
Id = source.Id;
ReferenceData = source.ReferenceData;
}
if (currentContext != null)
{
ClientId = currentContext.ClientId;
ClientVersion = currentContext.ClientVersion;
}
}
[JsonConverter(typeof(JsonStringEnumConverter))]
@ -52,6 +58,8 @@ public class ReferenceEvent
[JsonConverter(typeof(JsonStringEnumConverter))]
public SendType? SendType { get; set; }
public bool? SendHasNotes { get; set; }
public int? MaxAccessCount { get; set; }
public bool? HasPassword { get; set; }
@ -59,4 +67,7 @@ public class ReferenceEvent
public string EventRaisedByUser { get; set; }
public bool? SalesAssistedTrialStarted { get; set; }
public string ClientId { get; set; }
public Version? ClientVersion { get; set; }
}