1
0
mirror of https://github.com/bitwarden/server synced 2026-02-28 10:23:24 +00:00

[PM 32766][Defect] Regression: Unable to upload Premium License to Self Hosted instances (#7090)

* Fix the license version issue

* Fix the lint build error

* fix the build error

* Revert to return the UserLicense as json
This commit is contained in:
cyprain-okeke
2026-02-27 17:13:37 +01:00
committed by GitHub
parent 5da65d517f
commit 8b6056fa08
2 changed files with 8 additions and 11 deletions

View File

@@ -1,5 +1,4 @@
using Bit.Core.Billing.Licenses.Models.Api.Response;
using Bit.Core.Billing.Services;
using Bit.Core.Billing.Models.Business;
using Bit.Core.Entities;
using Bit.Core.Services;
@@ -7,17 +6,14 @@ namespace Bit.Core.Billing.Licenses.Queries;
public interface IGetUserLicenseQuery
{
Task<LicenseResponseModel> Run(User user);
Task<UserLicense> Run(User user);
}
public class GetUserLicenseQuery(
IUserService userService,
ILicensingService licensingService) : IGetUserLicenseQuery
IUserService userService) : IGetUserLicenseQuery
{
public async Task<LicenseResponseModel> Run(User user)
public async Task<UserLicense> Run(User user)
{
var license = await userService.GenerateLicenseAsync(user);
var claimsPrincipal = licensingService.GetClaimsPrincipalFromLicense(license);
return new LicenseResponseModel(license, claimsPrincipal);
return await userService.GenerateLicenseAsync(user);
}
}

View File

@@ -2,6 +2,7 @@
using Bit.Api.Billing.Models.Requests.Storage;
using Bit.Core.Billing.Commands;
using Bit.Core.Billing.Licenses.Queries;
using Bit.Core.Billing.Models.Business;
using Bit.Core.Billing.Premium.Commands;
using Bit.Core.Billing.Subscriptions.Commands;
using Bit.Core.Billing.Subscriptions.Queries;
@@ -44,10 +45,10 @@ public class AccountBillingVNextControllerTests
[Theory, BitAutoData]
public async Task GetLicenseAsync_ValidUser_ReturnsLicenseResponse(
User user,
Core.Billing.Licenses.Models.Api.Response.LicenseResponseModel licenseResponse)
UserLicense license)
{
// Arrange
_getUserLicenseQuery.Run(user).Returns(licenseResponse);
_getUserLicenseQuery.Run(user).Returns(license);
// Act
var result = await _sut.GetLicenseAsync(user);
// Assert