1
0
mirror of https://github.com/bitwarden/server synced 2026-02-21 20:03:40 +00:00

[PM-26378] Auto confirm events (#7017)

* implement auto confirm push notification

* fix test

* fix test

* simplify LINQ

* add event logging for auto confirm

* fix test
This commit is contained in:
Brandon Treston
2026-02-19 12:10:28 -05:00
committed by GitHub
parent 71a8116d4c
commit 31fe7b0e12
10 changed files with 246 additions and 0 deletions

View File

@@ -61,6 +61,7 @@ public class OrganizationsController : Controller
private readonly IPricingClient _pricingClient;
private readonly IResendOrganizationInviteCommand _resendOrganizationInviteCommand;
private readonly IOrganizationBillingService _organizationBillingService;
private readonly IEventService _eventService;
private readonly IAutomaticUserConfirmationOrganizationPolicyComplianceValidator _automaticUserConfirmationOrganizationPolicyComplianceValidator;
public OrganizationsController(
@@ -88,6 +89,7 @@ public class OrganizationsController : Controller
IPricingClient pricingClient,
IResendOrganizationInviteCommand resendOrganizationInviteCommand,
IOrganizationBillingService organizationBillingService,
IEventService eventService,
IAutomaticUserConfirmationOrganizationPolicyComplianceValidator automaticUserConfirmationOrganizationPolicyComplianceValidator)
{
_organizationRepository = organizationRepository;
@@ -114,6 +116,7 @@ public class OrganizationsController : Controller
_pricingClient = pricingClient;
_resendOrganizationInviteCommand = resendOrganizationInviteCommand;
_organizationBillingService = organizationBillingService;
_eventService = eventService;
_automaticUserConfirmationOrganizationPolicyComplianceValidator = automaticUserConfirmationOrganizationPolicyComplianceValidator;
}
@@ -283,6 +286,8 @@ public class OrganizationsController : Controller
}
}
var previousUseAutomaticUserConfirmation = organization.UseAutomaticUserConfirmation;
UpdateOrganization(organization, model);
var plan = await _pricingClient.GetPlanOrThrow(organization.PlanType);
if (organization.UseSecretsManager && !plan.SupportsSecretsManager)
@@ -304,6 +309,14 @@ public class OrganizationsController : Controller
await _organizationRepository.ReplaceAsync(organization);
if (previousUseAutomaticUserConfirmation != organization.UseAutomaticUserConfirmation)
{
var eventType = organization.UseAutomaticUserConfirmation
? EventType.Organization_AutoConfirmEnabled_Portal
: EventType.Organization_AutoConfirmDisabled_Portal;
await _eventService.LogOrganizationEventAsync(organization, eventType, EventSystemUser.BitwardenPortal);
}
await _applicationCacheService.UpsertOrganizationAbilityAsync(organization);
// Sync name/email changes to Stripe