1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 00:52:49 -05:00

Added Several New Reference Events (#1500)

* added enum values for new events

* hooked up directory sync event

* upgraded the OrganizationUpgrade ReferenceEvent

* Added metadata to the OrganizationUserInvited event noting if this is the first event sent from an organization

* Added metadata to the AdjustedSeats event

* Implemented vaultImported event

* Implemented FirstGroupAdded event

* Implemented FirstCollectionAdded event

* Implemented FirstSecretAdded event type

* Implemented SalesAssisted reference event

* changed events to match updated requirements

* renamed an event enum
This commit is contained in:
Addison Beck
2021-08-10 14:38:58 -04:00
committed by GitHub
parent 2e1df91232
commit 7928b25796
11 changed files with 98 additions and 25 deletions

View File

@ -5,6 +5,8 @@ using Bit.Core.Models.Table;
using Bit.Core.Repositories;
using System.Collections.Generic;
using Bit.Core.Models.Data;
using Bit.Core.Models.Business;
using Bit.Core.Enums;
namespace Bit.Core.Services
{
@ -16,6 +18,7 @@ namespace Bit.Core.Services
private readonly ICollectionRepository _collectionRepository;
private readonly IUserRepository _userRepository;
private readonly IMailService _mailService;
private readonly IReferenceEventService _referenceEventService;
public CollectionService(
IEventService eventService,
@ -23,7 +26,8 @@ namespace Bit.Core.Services
IOrganizationUserRepository organizationUserRepository,
ICollectionRepository collectionRepository,
IUserRepository userRepository,
IMailService mailService)
IMailService mailService,
IReferenceEventService referenceEventService)
{
_eventService = eventService;
_organizationRepository = organizationRepository;
@ -31,6 +35,7 @@ namespace Bit.Core.Services
_collectionRepository = collectionRepository;
_userRepository = userRepository;
_mailService = mailService;
_referenceEventService = referenceEventService;
}
public async Task SaveAsync(Collection collection, IEnumerable<SelectionReadOnly> groups = null,
@ -76,6 +81,7 @@ namespace Bit.Core.Services
}
await _eventService.LogCollectionEventAsync(collection, Enums.EventType.Collection_Created);
await _referenceEventService.RaiseEventAsync(new ReferenceEvent(ReferenceEventType.CollectionCreated, org));
}
else
{