1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 16:42:50 -05:00

[PM-15160] Create ResellerClientOrganizationSignUpCommand (#5981)

* Implement ResellerClientOrganizationSignUpCommand for signing up reseller client organizations with email invitations and error handling

* Refactor ProvidersController to replace IOrganizationService with IResellerClientOrganizationSignUpCommand for organization sign-up process

* Remove CreatePendingOrganization method from IOrganizationService and its implementation in OrganizationService

* Add IResellerClientOrganizationSignUpCommand to service collection for organization sign-up

* Add comment to clarify organization deletion process in ResellerClientOrganizationSignUpCommand
This commit is contained in:
Rui Tomé
2025-06-24 13:33:09 +01:00
committed by GitHub
parent cc07f13c7c
commit 494c41e3b1
6 changed files with 323 additions and 35 deletions

View File

@ -1,5 +1,4 @@
using System.Security.Claims;
using System.Text.Json;
using System.Text.Json;
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.Enums.Provider;
@ -1705,27 +1704,4 @@ public class OrganizationService : IOrganizationService
return status;
}
public async Task CreatePendingOrganization(Organization organization, string ownerEmail, ClaimsPrincipal user, IUserService userService, bool salesAssistedTrialStarted)
{
organization.Id = CoreHelpers.GenerateComb();
organization.Enabled = false;
organization.Status = OrganizationStatusType.Pending;
await SignUpAsync(organization, default, null, null, true);
var ownerOrganizationUser = new OrganizationUser
{
OrganizationId = organization.Id,
UserId = null,
Email = ownerEmail,
Key = null,
Type = OrganizationUserType.Owner,
Status = OrganizationUserStatusType.Invited,
};
await _organizationUserRepository.CreateAsync(ownerOrganizationUser);
await SendInviteAsync(ownerOrganizationUser, organization, true);
await _eventService.LogOrganizationUserEventAsync(ownerOrganizationUser, EventType.OrganizationUser_Invited);
}
}