mirror of
https://github.com/bitwarden/server.git
synced 2025-07-04 01:22:50 -05:00
[AC-358] Server changes for self host subscription page changes (#2826)
* [AC-358] Add constant for grace period length * [AC-358] Add SubscriptionExpiration to OrganizationLicense.cs and increment Current_License_File_Version * [AC-358] Update org subscription response model - Add new SelfHostSubscriptionExpiration field that does not include a grace period - Add optional License argument to constructor for self host responses - Use the License, if available, to populate the expiration/subscription expiration fields - Maintain backwards compatability by falling back to organization expiration date * [AC-358] Read organization license file for self hosted subscription response * [AC-358] Decrement current license file version and add comment documenting why * [AC-358] Clarify name for new expiration without grace period field
This commit is contained in:
@ -50,6 +50,7 @@ public class OrganizationsController : Controller
|
||||
private readonly ICloudGetOrganizationLicenseQuery _cloudGetOrganizationLicenseQuery;
|
||||
private readonly IFeatureService _featureService;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly ILicensingService _licensingService;
|
||||
|
||||
public OrganizationsController(
|
||||
IOrganizationRepository organizationRepository,
|
||||
@ -69,7 +70,8 @@ public class OrganizationsController : Controller
|
||||
IUpdateOrganizationLicenseCommand updateOrganizationLicenseCommand,
|
||||
ICloudGetOrganizationLicenseQuery cloudGetOrganizationLicenseQuery,
|
||||
IFeatureService featureService,
|
||||
GlobalSettings globalSettings)
|
||||
GlobalSettings globalSettings,
|
||||
ILicensingService licensingService)
|
||||
{
|
||||
_organizationRepository = organizationRepository;
|
||||
_organizationUserRepository = organizationUserRepository;
|
||||
@ -89,6 +91,7 @@ public class OrganizationsController : Controller
|
||||
_cloudGetOrganizationLicenseQuery = cloudGetOrganizationLicenseQuery;
|
||||
_featureService = featureService;
|
||||
_globalSettings = globalSettings;
|
||||
_licensingService = licensingService;
|
||||
}
|
||||
|
||||
[HttpGet("{id}")]
|
||||
@ -156,10 +159,14 @@ public class OrganizationsController : Controller
|
||||
|
||||
return new OrganizationSubscriptionResponseModel(organization, subscriptionInfo, hideSensitiveData);
|
||||
}
|
||||
else
|
||||
|
||||
if (_globalSettings.SelfHosted)
|
||||
{
|
||||
return new OrganizationSubscriptionResponseModel(organization);
|
||||
var orgLicense = await _licensingService.ReadOrganizationLicenseAsync(organization);
|
||||
return new OrganizationSubscriptionResponseModel(organization, orgLicense);
|
||||
}
|
||||
|
||||
return new OrganizationSubscriptionResponseModel(organization);
|
||||
}
|
||||
|
||||
[HttpGet("{id}/license")]
|
||||
|
Reference in New Issue
Block a user