mirror of
https://github.com/bitwarden/server.git
synced 2025-07-06 10:32:49 -05:00
cipher events
This commit is contained in:
@ -7,25 +7,28 @@ namespace Bit.Core.Models.Data
|
||||
{
|
||||
public class CipherEvent : EventTableEntity
|
||||
{
|
||||
public CipherEvent(Cipher cipher, EventType type)
|
||||
public CipherEvent(Cipher cipher, EventType type, Guid? actingUserId = null)
|
||||
{
|
||||
OrganizationId = cipher.OrganizationId;
|
||||
UserId = cipher.UserId;
|
||||
CipherId = cipher.Id;
|
||||
Type = (int)type;
|
||||
ActingUserId = actingUserId;
|
||||
|
||||
Timestamp = DateTime.UtcNow;
|
||||
if(OrganizationId.HasValue)
|
||||
{
|
||||
UserId = null;
|
||||
PartitionKey = $"OrganizationId={OrganizationId}";
|
||||
RowKey = string.Format("Date={0}__CipherId={1}__ActingUserId={2}__Type={3}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), CipherId, ActingUserId, Type);
|
||||
}
|
||||
else
|
||||
{
|
||||
PartitionKey = $"UserId={UserId}";
|
||||
RowKey = string.Format("Date={0}__CipherId={1}__Type={2}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), CipherId, Type);
|
||||
}
|
||||
|
||||
RowKey = string.Format("Date={0}__CipherId={1}__Type={2}",
|
||||
CoreHelpers.DateTimeToTableStorageKey(Timestamp.DateTime), CipherId, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,6 @@ namespace Bit.Core.Models.Data
|
||||
public Guid? OrganizationId { get; set; }
|
||||
public Guid? CipherId { get; set; }
|
||||
public ICollection<Guid> CipherIds { get; set; }
|
||||
public Guid? ActingUserId { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user