mirror of
https://github.com/bitwarden/server
synced 2025-12-31 07:33:43 +00:00
[EC-92] Add organization vault export to event logs (#2128)
* Added nullable OrganizationId to EventModel * Added EventType Organization_ClientExportedVault * Updated CollectController to save the event Organization_ClientExportedVault * Added OrganizationExportResponseModel to encapsulate Organization Export data * Added OrganizationExportController to have a single endpoint for Organization vault export * Added method GetOrganizationCollections to ICollectionService to get collections for an organization * Added GetOrganizationCiphers to ICipherService to get ciphers for an organization * Updated controllers to use new methods in ICollectionService and ICipherService
This commit is contained in:
@@ -17,15 +17,18 @@ namespace Bit.Events.Controllers
|
||||
private readonly ICurrentContext _currentContext;
|
||||
private readonly IEventService _eventService;
|
||||
private readonly ICipherRepository _cipherRepository;
|
||||
private readonly IOrganizationRepository _organizationRepository;
|
||||
|
||||
public CollectController(
|
||||
ICurrentContext currentContext,
|
||||
IEventService eventService,
|
||||
ICipherRepository cipherRepository)
|
||||
ICipherRepository cipherRepository,
|
||||
IOrganizationRepository organizationRepository)
|
||||
{
|
||||
_currentContext = currentContext;
|
||||
_eventService = eventService;
|
||||
_cipherRepository = cipherRepository;
|
||||
_organizationRepository = organizationRepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -78,6 +81,14 @@ namespace Bit.Events.Controllers
|
||||
}
|
||||
cipherEvents.Add(new Tuple<Cipher, EventType, DateTime?>(cipher, eventModel.Type, eventModel.Date));
|
||||
break;
|
||||
case EventType.Organization_ClientExportedVault:
|
||||
if (!eventModel.OrganizationId.HasValue)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var organization = await _organizationRepository.GetByIdAsync(eventModel.OrganizationId.Value);
|
||||
await _eventService.LogOrganizationEventAsync(organization, eventModel.Type, eventModel.Date);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user