diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index 7b00cfccd4..843d66e5b2 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -554,8 +554,8 @@ namespace Bit.Core.Services "hosting of organizations and that the installation id matches your current installation."); } - var plan = StaticStore.Plans.FirstOrDefault(p => p.Type == license.PlanType && !p.Disabled); - if(plan == null) + if(license.PlanType != PlanType.Custom && + StaticStore.Plans.FirstOrDefault(p => p.Type == license.PlanType && !p.Disabled) == null) { throw new BadRequestException("Plan not found."); } @@ -590,6 +590,15 @@ namespace Bit.Core.Services Directory.CreateDirectory(dir); File.WriteAllText($"{dir}/{organization.Id}.json", JsonConvert.SerializeObject(license, Formatting.Indented)); + // self-hosted org users get premium access + if(!owner.Premium && result.Item1.Enabled) + { + owner.Premium = true; + owner.MaxStorageGb = 10240; // 10 TB + owner.RevisionDate = DateTime.UtcNow; + await _userRepository.ReplaceAsync(owner); + } + return result; }