From 14c8edfcb788ba081b2d5dcafd285f1ecb4ab722 Mon Sep 17 00:00:00 2001 From: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Date: Tue, 7 Mar 2023 13:28:29 +1000 Subject: [PATCH] Remove obsolete selfhosted license endpoints (#2727) --- .../Controllers/OrganizationsController.cs | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/src/Api/Controllers/OrganizationsController.cs b/src/Api/Controllers/OrganizationsController.cs index e4c400319..eb242a475 100644 --- a/src/Api/Controllers/OrganizationsController.cs +++ b/src/Api/Controllers/OrganizationsController.cs @@ -5,7 +5,6 @@ using Bit.Api.Models.Request.Organizations; using Bit.Api.Models.Response; using Bit.Api.Models.Response.Organizations; using Bit.Api.SecretsManager; -using Bit.Api.Utilities; using Bit.Core.Context; using Bit.Core.Enums; using Bit.Core.Exceptions; @@ -225,28 +224,6 @@ public class OrganizationsController : Controller return new OrganizationResponseModel(result.Item1); } - [Obsolete("2022-12-7 Moved to SelfHostedOrganizationLicensesController, to be removed in EC-815")] - [HttpPost("license")] - [SelfHosted(SelfHostedOnly = true)] - public async Task PostLicense(OrganizationCreateLicenseRequestModel model) - { - var user = await _userService.GetUserByPrincipalAsync(User); - if (user == null) - { - throw new UnauthorizedAccessException(); - } - - var license = await ApiHelpers.ReadJsonFileFromBody(HttpContext, model.License); - if (license == null) - { - throw new BadRequestException("Invalid license"); - } - - var result = await _organizationService.SignUpAsync(license, user, model.Key, - model.CollectionName, model.Keys?.PublicKey, model.Keys?.EncryptedPrivateKey); - return new OrganizationResponseModel(result.Item1); - } - [HttpPut("{id}")] [HttpPost("{id}")] public async Task Put(string id, [FromBody] OrganizationUpdateRequestModel model) @@ -447,34 +424,6 @@ public class OrganizationsController : Controller } } - [Obsolete("2022-12-7 Moved to SelfHostedOrganizationLicensesController, to be removed in EC-815")] - [HttpPost("{id}/license")] - [SelfHosted(SelfHostedOnly = true)] - public async Task PostLicense(string id, LicenseRequestModel model) - { - var orgIdGuid = new Guid(id); - if (!await _currentContext.OrganizationOwner(orgIdGuid)) - { - throw new NotFoundException(); - } - - var license = await ApiHelpers.ReadJsonFileFromBody(HttpContext, model.License); - if (license == null) - { - throw new BadRequestException("Invalid license"); - } - - var selfHostedOrganizationDetails = await _organizationRepository.GetSelfHostedOrganizationDetailsById(orgIdGuid); - if (selfHostedOrganizationDetails == null) - { - throw new NotFoundException(); - } - - var existingOrganization = await _organizationRepository.GetByLicenseKeyAsync(license.LicenseKey); - - await _updateOrganizationLicenseCommand.UpdateLicenseAsync(selfHostedOrganizationDetails, license, existingOrganization); - } - [HttpPost("{id}/import")] public async Task Import(string id, [FromBody] ImportOrganizationUsersRequestModel model) {