mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 01:22:50 -05:00
update org license API
This commit is contained in:
@ -12,8 +12,6 @@ using System.Linq;
|
||||
using Bit.Core.Repositories;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Bit.Core.Models.Business;
|
||||
using Bit.Api.Utilities;
|
||||
|
||||
|
@ -296,6 +296,26 @@ namespace Bit.Api.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut("{id}/license")]
|
||||
[HttpPost("{id}/license")]
|
||||
[SelfHosted(SelfHostedOnly = true)]
|
||||
public async Task PutLicense(string id, LicenseRequestModel model)
|
||||
{
|
||||
var orgIdGuid = new Guid(id);
|
||||
if(!_currentContext.OrganizationOwner(orgIdGuid))
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
|
||||
var license = await ApiHelpers.ReadJsonFileFromBody<UserLicense>(HttpContext, model.License);
|
||||
if(license == null)
|
||||
{
|
||||
throw new BadRequestException("Invalid license");
|
||||
}
|
||||
|
||||
await _organizationService.UpdateLicenseAsync(id, license);
|
||||
}
|
||||
|
||||
[HttpPost("{id}/import")]
|
||||
public async Task Import(string id, [FromBody]ImportOrganizationUsersRequestModel model)
|
||||
{
|
||||
|
Reference in New Issue
Block a user