1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -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

@ -9,6 +9,8 @@ using Bit.Core.Models.Table;
using Bit.Core.Utilities;
using Bit.Core.Services;
using Bit.Core.Settings;
using Bit.Core.Models.Business;
using Bit.Core.Enums;
namespace Bit.Admin.Controllers
{
@ -24,6 +26,7 @@ namespace Bit.Admin.Controllers
private readonly IPaymentService _paymentService;
private readonly IApplicationCacheService _applicationCacheService;
private readonly GlobalSettings _globalSettings;
private readonly IReferenceEventService _referenceEventService;
public OrganizationsController(
IOrganizationRepository organizationRepository,
@ -34,7 +37,8 @@ namespace Bit.Admin.Controllers
IPolicyRepository policyRepository,
IPaymentService paymentService,
IApplicationCacheService applicationCacheService,
GlobalSettings globalSettings)
GlobalSettings globalSettings,
IReferenceEventService referenceEventService)
{
_organizationRepository = organizationRepository;
_organizationUserRepository = organizationUserRepository;
@ -45,6 +49,7 @@ namespace Bit.Admin.Controllers
_paymentService = paymentService;
_applicationCacheService = applicationCacheService;
_globalSettings = globalSettings;
_referenceEventService = referenceEventService;
}
public async Task<IActionResult> Index(string name = null, string userEmail = null, bool? paid = null,
@ -140,6 +145,7 @@ namespace Bit.Admin.Controllers
model.ToOrganization(organization);
await _organizationRepository.ReplaceAsync(organization);
await _applicationCacheService.UpsertOrganizationAbilityAsync(organization);
await _referenceEventService.RaiseEventAsync(new ReferenceEvent(ReferenceEventType.SalesAssisted, organization));
return RedirectToAction("Edit", new { id });
}