mirror of
https://github.com/bitwarden/server.git
synced 2025-07-12 13:19:01 -05:00
[PM-21727] Add feature to plan and license constructor (#5834)
* add feature to plan * add license to ctor for old license file creation method
This commit is contained in:
@ -309,6 +309,7 @@ public class OrganizationMigrator(
|
||||
organization.MaxStorageGb = plan.PasswordManager.BaseStorageGb;
|
||||
organization.UsePolicies = plan.HasPolicies;
|
||||
organization.UseSso = plan.HasSso;
|
||||
organization.UseOrganizationDomains = plan.HasOrganizationDomains;
|
||||
organization.UseGroups = plan.HasGroups;
|
||||
organization.UseEvents = plan.HasEvents;
|
||||
organization.UseDirectory = plan.HasDirectory;
|
||||
|
@ -26,6 +26,7 @@ public record Enterprise2019Plan : Plan
|
||||
Has2fa = true;
|
||||
HasApi = true;
|
||||
HasSso = true;
|
||||
HasOrganizationDomains = true;
|
||||
HasKeyConnector = true;
|
||||
HasScim = true;
|
||||
HasResetPassword = true;
|
||||
|
@ -26,6 +26,7 @@ public record Enterprise2020Plan : Plan
|
||||
Has2fa = true;
|
||||
HasApi = true;
|
||||
HasSso = true;
|
||||
HasOrganizationDomains = true;
|
||||
HasKeyConnector = true;
|
||||
HasScim = true;
|
||||
HasResetPassword = true;
|
||||
|
@ -26,6 +26,7 @@ public record EnterprisePlan : Plan
|
||||
Has2fa = true;
|
||||
HasApi = true;
|
||||
HasSso = true;
|
||||
HasOrganizationDomains = true;
|
||||
HasKeyConnector = true;
|
||||
HasScim = true;
|
||||
HasResetPassword = true;
|
||||
|
@ -26,6 +26,7 @@ public record Enterprise2023Plan : Plan
|
||||
Has2fa = true;
|
||||
HasApi = true;
|
||||
HasSso = true;
|
||||
HasOrganizationDomains = true;
|
||||
HasKeyConnector = true;
|
||||
HasScim = true;
|
||||
HasResetPassword = true;
|
||||
|
@ -26,6 +26,7 @@ public record PlanAdapter : Plan
|
||||
Has2fa = HasFeature("2fa");
|
||||
HasApi = HasFeature("api");
|
||||
HasSso = HasFeature("sso");
|
||||
HasOrganizationDomains = HasFeature("organizationDomains");
|
||||
HasKeyConnector = HasFeature("keyConnector");
|
||||
HasScim = HasFeature("scim");
|
||||
HasResetPassword = HasFeature("resetPassword");
|
||||
|
@ -84,6 +84,7 @@ public class OrganizationLicense : ILicense
|
||||
SmSeats = org.SmSeats;
|
||||
SmServiceAccounts = org.SmServiceAccounts;
|
||||
UseRiskInsights = org.UseRiskInsights;
|
||||
UseOrganizationDomains = org.UseOrganizationDomains;
|
||||
|
||||
// Deprecated. Left for backwards compatibility with old license versions.
|
||||
LimitCollectionCreationDeletion = org.LimitCollectionCreation || org.LimitCollectionDeletion;
|
||||
@ -195,10 +196,10 @@ public class OrganizationLicense : ILicense
|
||||
/// <remarks>Intentionally set one version behind to allow self hosted users some time to update before
|
||||
/// getting out of date license errors
|
||||
/// </remarks>
|
||||
public const int CurrentLicenseFileVersion = 14;
|
||||
public const int CurrentLicenseFileVersion = 15;
|
||||
private bool ValidLicenseVersion
|
||||
{
|
||||
get => Version is >= 1 and <= 15;
|
||||
get => Version is >= 1 and <= 16;
|
||||
}
|
||||
|
||||
public byte[] GetDataBytes(bool forHash = false)
|
||||
@ -244,6 +245,8 @@ public class OrganizationLicense : ILicense
|
||||
(Version >= 14 || !p.Name.Equals(nameof(LimitCollectionCreationDeletion))) &&
|
||||
// AllowAdminAccessToAllCollectionItems was added in Version 15
|
||||
(Version >= 15 || !p.Name.Equals(nameof(AllowAdminAccessToAllCollectionItems))) &&
|
||||
// UseOrganizationDomains was added in Version 16
|
||||
(Version >= 16 || !p.Name.Equals(nameof(UseOrganizationDomains))) &&
|
||||
(
|
||||
!forHash ||
|
||||
(
|
||||
@ -583,6 +586,11 @@ public class OrganizationLicense : ILicense
|
||||
* validation.
|
||||
*/
|
||||
|
||||
if (valid && Version >= 16)
|
||||
{
|
||||
valid = organization.UseOrganizationDomains;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user