1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

Added additional validation to ensure that the license type is accurate

This commit is contained in:
Conner Turnbull 2024-11-08 11:05:30 -05:00
parent 8d78c17bd0
commit bcc80ca3f9
No known key found for this signature in database
GPG Key ID: D42CA06D8EB866CC

View File

@ -648,6 +648,12 @@ public class OrganizationService : IOrganizationService
OrganizationLicense license, User owner, string ownerKey, string collectionName, string publicKey, OrganizationLicense license, User owner, string ownerKey, string collectionName, string publicKey,
string privateKey) string privateKey)
{ {
if (license.LicenseType != LicenseType.Organization)
{
throw new BadRequestException("Premium licenses cannot be applied to an organization. " +
"Upload this license from your personal account settings page.");
}
var canUse = license.CanUse(_globalSettings, _licensingService, out var exception); var canUse = license.CanUse(_globalSettings, _licensingService, out var exception);
if (!canUse) if (!canUse)
{ {