1
0
mirror of https://github.com/bitwarden/server synced 2026-01-05 10:03:23 +00:00

[PM-15159] Create SelfHostedOrganizationSignUp command (#6089)

* Add SelfHostedOrganizationSignUpCommand for organization sign-up process

Method extracted from OrganizationService

* Register SelfHostedOrganizationSignUpCommand for dependency injection

* Add unit tests for SelfHostedOrganizationSignUpCommand

* Refactor SelfHostedOrganizationLicensesController to use ISelfHostedOrganizationSignUpCommand

* Remove SignUpAsync method and related validation from IOrganizationService and OrganizationService

* Move ISelfHostedOrganizationSignUpCommand into a separate file and update references

* Enable null safety in SelfHostedOrganizationSignUpCommand and update ISelfHostedOrganizationSignUpCommand interface to reflect nullable types for organizationUser and collectionName.
This commit is contained in:
Rui Tomé
2025-07-21 14:35:41 +01:00
committed by GitHub
parent 79661dd5f5
commit 4464bfe900
7 changed files with 588 additions and 168 deletions

View File

@@ -5,6 +5,7 @@ using Bit.Api.AdminConsole.Models.Response.Organizations;
using Bit.Api.Models.Request;
using Bit.Api.Models.Request.Organizations;
using Bit.Api.Utilities;
using Bit.Core.AdminConsole.OrganizationFeatures.Organizations.Interfaces;
using Bit.Core.Billing.Organizations.Commands;
using Bit.Core.Billing.Organizations.Models;
using Bit.Core.Billing.Organizations.Queries;
@@ -28,7 +29,7 @@ public class SelfHostedOrganizationLicensesController : Controller
private readonly ICurrentContext _currentContext;
private readonly IGetSelfHostedOrganizationLicenseQuery _getSelfHostedOrganizationLicenseQuery;
private readonly IOrganizationConnectionRepository _organizationConnectionRepository;
private readonly IOrganizationService _organizationService;
private readonly ISelfHostedOrganizationSignUpCommand _selfHostedOrganizationSignUpCommand;
private readonly IOrganizationRepository _organizationRepository;
private readonly IUserService _userService;
private readonly IUpdateOrganizationLicenseCommand _updateOrganizationLicenseCommand;
@@ -37,7 +38,7 @@ public class SelfHostedOrganizationLicensesController : Controller
ICurrentContext currentContext,
IGetSelfHostedOrganizationLicenseQuery getSelfHostedOrganizationLicenseQuery,
IOrganizationConnectionRepository organizationConnectionRepository,
IOrganizationService organizationService,
ISelfHostedOrganizationSignUpCommand selfHostedOrganizationSignUpCommand,
IOrganizationRepository organizationRepository,
IUserService userService,
IUpdateOrganizationLicenseCommand updateOrganizationLicenseCommand)
@@ -45,7 +46,7 @@ public class SelfHostedOrganizationLicensesController : Controller
_currentContext = currentContext;
_getSelfHostedOrganizationLicenseQuery = getSelfHostedOrganizationLicenseQuery;
_organizationConnectionRepository = organizationConnectionRepository;
_organizationService = organizationService;
_selfHostedOrganizationSignUpCommand = selfHostedOrganizationSignUpCommand;
_organizationRepository = organizationRepository;
_userService = userService;
_updateOrganizationLicenseCommand = updateOrganizationLicenseCommand;
@@ -66,7 +67,7 @@ public class SelfHostedOrganizationLicensesController : Controller
throw new BadRequestException("Invalid license");
}
var result = await _organizationService.SignUpAsync(license, user, model.Key,
var result = await _selfHostedOrganizationSignUpCommand.SignUpAsync(license, user, model.Key,
model.CollectionName, model.Keys?.PublicKey, model.Keys?.EncryptedPrivateKey);
return new OrganizationResponseModel(result.Item1, null);