1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

added org flag for UseEvents

This commit is contained in:
Kyle Spearrin
2017-12-14 15:48:44 -05:00
parent 2c4ce27ef2
commit 172fd2425e
15 changed files with 305 additions and 7 deletions

View File

@ -31,6 +31,7 @@ namespace Bit.Core.Models.Api
MaxCollections = organization.MaxCollections;
UseGroups = organization.UseGroups;
UseDirectory = organization.UseDirectory;
UseEvents = organization.UseEvents;
UseTotp = organization.UseTotp;
}
@ -49,6 +50,7 @@ namespace Bit.Core.Models.Api
public short? MaxCollections { get; set; }
public bool UseGroups { get; set; }
public bool UseDirectory { get; set; }
public bool UseEvents { get; set; }
public bool UseTotp { get; set; }
}

View File

@ -12,6 +12,7 @@ namespace Bit.Core.Models.Api
Name = organization.Name;
UseGroups = organization.UseGroups;
UseDirectory = organization.UseDirectory;
UseEvents = organization.UseEvents;
UseTotp = organization.UseTotp;
Seats = organization.Seats;
MaxCollections = organization.MaxCollections;
@ -26,6 +27,7 @@ namespace Bit.Core.Models.Api
public string Name { get; set; }
public bool UseGroups { get; set; }
public bool UseDirectory { get; set; }
public bool UseEvents { get; set; }
public bool UseTotp { get; set; }
public int Seats { get; set; }
public int MaxCollections { get; set; }

View File

@ -19,7 +19,7 @@ namespace Bit.Core.Models.Business
public OrganizationLicense(Organization org, BillingInfo billingInfo, Guid installationId,
ILicensingService licenseService)
{
Version = 2;
Version = 3;
LicenseKey = org.LicenseKey;
InstallationId = installationId;
Id = org.Id;
@ -32,6 +32,7 @@ namespace Bit.Core.Models.Business
Seats = org.Seats;
MaxCollections = org.MaxCollections;
UseGroups = org.UseGroups;
UseEvents = org.UseEvents;
UseDirectory = org.UseDirectory;
UseTotp = org.UseTotp;
MaxStorageGb = org.MaxStorageGb;
@ -96,6 +97,7 @@ namespace Bit.Core.Models.Business
public short? Seats { get; set; }
public short? MaxCollections { get; set; }
public bool UseGroups { get; set; }
public bool UseEvents { get; set; }
public bool UseDirectory { get; set; }
public bool UseTotp { get; set; }
public short? MaxStorageGb { get; set; }
@ -114,7 +116,7 @@ namespace Bit.Core.Models.Business
public byte[] GetDataBytes(bool forHash = false)
{
string data = null;
if(Version == 1 || Version == 2)
if(Version >= 1 && Version <= 3)
{
var props = typeof(OrganizationLicense)
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
@ -122,7 +124,9 @@ namespace Bit.Core.Models.Business
!p.Name.Equals(nameof(Signature)) &&
!p.Name.Equals(nameof(SignatureBytes)) &&
// UsersGetPremium was added in Version 2
(Version > 1 || !p.Name.Equals(nameof(UsersGetPremium))) &&
(Version >= 2 || !p.Name.Equals(nameof(UsersGetPremium))) &&
// UseEvents was added in Version 3
(Version >= 3 || !p.Name.Equals(nameof(UseEvents))) &&
(
!forHash ||
(
@ -159,7 +163,7 @@ namespace Bit.Core.Models.Business
return false;
}
if(Version == 1 || Version == 2)
if(Version >= 1 && Version <= 3)
{
return InstallationId == globalSettings.Installation.Id && SelfHost;
}
@ -176,7 +180,7 @@ namespace Bit.Core.Models.Business
return false;
}
if(Version == 1 || Version == 2)
if(Version >= 1 && Version <= 3)
{
var valid =
globalSettings.Installation.Id == InstallationId &&
@ -191,11 +195,16 @@ namespace Bit.Core.Models.Business
organization.SelfHost == SelfHost &&
organization.Name.Equals(Name);
if(valid && Version == 2)
if(valid && Version >= 2)
{
valid = organization.UsersGetPremium == UsersGetPremium;
}
if(valid && Version >= 3)
{
valid = organization.UseEvents == UseEvents;
}
return valid;
}
else

View File

@ -9,6 +9,7 @@ namespace Bit.Core.Models.Data
public string Name { get; set; }
public bool UseGroups { get; set; }
public bool UseDirectory { get; set; }
public bool UseEvents { get; set; }
public bool UseTotp { get; set; }
public bool SelfHost { get; set; }
public bool UsersGetPremium { get; set; }

View File

@ -14,6 +14,7 @@ namespace Bit.Core.Models.StaticStore
public short? MaxAdditionalSeats { get; set; }
public bool UseGroups { get; set; }
public bool UseDirectory { get; set; }
public bool UseEvents { get; set; }
public bool UseTotp { get; set; }
public short? MaxStorageGb { get; set; }
public decimal BasePrice { get; set; }

View File

@ -23,6 +23,7 @@ namespace Bit.Core.Models.Table
public short? MaxCollections { get; set; }
public bool UseGroups { get; set; }
public bool UseDirectory { get; set; }
public bool UseEvents { get; set; }
public bool UseTotp { get; set; }
public bool SelfHost { get; set; }
public bool UsersGetPremium { get; set; }