mirror of
https://github.com/bitwarden/server
synced 2026-02-24 00:23:05 +00:00
Resolving bug with Mangler and Organizations (#7057)
This commit is contained in:
@@ -3,18 +3,19 @@ using Bit.Core.Billing.Enums;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Seeder.Services;
|
||||
|
||||
namespace Bit.Seeder.Factories;
|
||||
|
||||
internal static class OrganizationSeeder
|
||||
{
|
||||
internal static Organization Create(string name, string domain, int seats, string? publicKey = null, string? privateKey = null, PlanType planType = PlanType.EnterpriseAnnually)
|
||||
internal static Organization Create(string name, string domain, int seats, IManglerService manglerService, string? publicKey = null, string? privateKey = null, PlanType planType = PlanType.EnterpriseAnnually)
|
||||
{
|
||||
var org = new Organization
|
||||
{
|
||||
Id = CoreHelpers.GenerateComb(),
|
||||
Identifier = domain,
|
||||
Name = name,
|
||||
Identifier = manglerService.Mangle(domain),
|
||||
Name = manglerService.Mangle(name),
|
||||
BillingEmail = $"billing@{domain}",
|
||||
Seats = seats,
|
||||
Status = OrganizationStatusType.Created,
|
||||
|
||||
@@ -26,7 +26,7 @@ public class OrganizationWithUsersRecipe(
|
||||
// Generate organization keys
|
||||
var orgKeys = RustSdkService.GenerateOrganizationKeys();
|
||||
var organization = OrganizationSeeder.Create(
|
||||
name, domain, seats, orgKeys.PublicKey, orgKeys.PrivateKey);
|
||||
name, domain, seats, manglerService, orgKeys.PublicKey, orgKeys.PrivateKey);
|
||||
|
||||
// Create owner with SDK-generated keys
|
||||
var ownerUser = UserSeeder.Create($"owner@{domain}", passwordHasher, manglerService);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class OrganizationWithVaultRecipe(
|
||||
|
||||
// Create organization via factory
|
||||
var organization = OrganizationSeeder.Create(
|
||||
options.Name, options.Domain, seats, orgKeys.PublicKey, orgKeys.PrivateKey, options.PlanType);
|
||||
options.Name, options.Domain, seats, manglerService, orgKeys.PublicKey, orgKeys.PrivateKey, options.PlanType);
|
||||
|
||||
// Create owner user via factory
|
||||
var ownerEmail = $"owner@{options.Domain}";
|
||||
|
||||
@@ -56,7 +56,7 @@ internal sealed class CreateOrganizationStep : IStep
|
||||
|
||||
var seats = _seats ?? PlanFeatures.GenerateRealisticSeatCount(_planType, domain);
|
||||
var orgKeys = RustSdkService.GenerateOrganizationKeys();
|
||||
var organization = OrganizationSeeder.Create(name, domain, seats, orgKeys.PublicKey, orgKeys.PrivateKey, _planType);
|
||||
var organization = OrganizationSeeder.Create(name, domain, seats, context.GetMangler(), orgKeys.PublicKey, orgKeys.PrivateKey, _planType);
|
||||
|
||||
context.Organization = organization;
|
||||
context.OrgKeys = orgKeys;
|
||||
|
||||
Reference in New Issue
Block a user