mirror of
https://github.com/bitwarden/server.git
synced 2025-04-09 07:08:15 -05:00
upgrade owner to premium on SH org create
This commit is contained in:
parent
f2ae8bc132
commit
e3f12c46c3
@ -554,8 +554,8 @@ namespace Bit.Core.Services
|
|||||||
"hosting of organizations and that the installation id matches your current installation.");
|
"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(license.PlanType != PlanType.Custom &&
|
||||||
if(plan == null)
|
StaticStore.Plans.FirstOrDefault(p => p.Type == license.PlanType && !p.Disabled) == null)
|
||||||
{
|
{
|
||||||
throw new BadRequestException("Plan not found.");
|
throw new BadRequestException("Plan not found.");
|
||||||
}
|
}
|
||||||
@ -590,6 +590,15 @@ namespace Bit.Core.Services
|
|||||||
Directory.CreateDirectory(dir);
|
Directory.CreateDirectory(dir);
|
||||||
File.WriteAllText($"{dir}/{organization.Id}.json", JsonConvert.SerializeObject(license, Formatting.Indented));
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user