1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-10 04:14:41 -05:00

add api support for updating org identifier (#861)

* add api support for updating org identifier

* add identifier to response as well

* implement in EF repo
This commit is contained in:
Kyle Spearrin
2020-08-12 16:38:22 -04:00
committed by GitHub
parent c8220fdfa6
commit 056b4b9bf4
8 changed files with 72 additions and 0 deletions

View File

@ -885,6 +885,15 @@ namespace Bit.Core.Services
throw new ApplicationException("Cannot create org this way. Call SignUpAsync.");
}
if (!string.IsNullOrWhiteSpace(organization.Identifier))
{
var orgById = await _organizationRepository.GetByIdentifierAsync(organization.Identifier);
if (orgById != null && orgById.Id != organization.Id)
{
throw new BadRequestException("Identifier already in use by another organization.");
}
}
await ReplaceAndUpdateCache(organization, EventType.Organization_Updated);
if (updateBilling && !string.IsNullOrWhiteSpace(organization.GatewayCustomerId))