mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 09:02:48 -05:00
Added UseSso bool to Organization (#834)
* Added UseSso bool to org * Update fields in migration script * bump version & check enabled flag on ssoConfig
This commit is contained in:
@ -19,7 +19,7 @@ namespace Bit.Core.Models.Business
|
||||
public OrganizationLicense(Organization org, SubscriptionInfo subscriptionInfo, Guid installationId,
|
||||
ILicensingService licenseService)
|
||||
{
|
||||
Version = 5; // TODO: bump to version 6
|
||||
Version = 6; // TODO: bump to version 7
|
||||
LicenseKey = org.LicenseKey;
|
||||
InstallationId = installationId;
|
||||
Id = org.Id;
|
||||
@ -32,6 +32,7 @@ namespace Bit.Core.Models.Business
|
||||
Seats = org.Seats;
|
||||
MaxCollections = org.MaxCollections;
|
||||
UsePolicies = org.UsePolicies;
|
||||
UseSso = org.UseSso;
|
||||
UseGroups = org.UseGroups;
|
||||
UseEvents = org.UseEvents;
|
||||
UseDirectory = org.UseDirectory;
|
||||
@ -100,6 +101,7 @@ namespace Bit.Core.Models.Business
|
||||
public short? Seats { get; set; }
|
||||
public short? MaxCollections { get; set; }
|
||||
public bool UsePolicies { get; set; }
|
||||
public bool UseSso { get; set; }
|
||||
public bool UseGroups { get; set; }
|
||||
public bool UseEvents { get; set; }
|
||||
public bool UseDirectory { get; set; }
|
||||
@ -122,7 +124,7 @@ namespace Bit.Core.Models.Business
|
||||
public byte[] GetDataBytes(bool forHash = false)
|
||||
{
|
||||
string data = null;
|
||||
if (Version >= 1 && Version <= 6)
|
||||
if (Version >= 1 && Version <= 7)
|
||||
{
|
||||
var props = typeof(OrganizationLicense)
|
||||
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
|
||||
@ -139,6 +141,8 @@ namespace Bit.Core.Models.Business
|
||||
(Version >= 5 || !p.Name.Equals(nameof(UseApi))) &&
|
||||
// UsePolicies was added in Version 6
|
||||
(Version >= 6 || !p.Name.Equals(nameof(UsePolicies))) &&
|
||||
// UseSso was added in Version 7
|
||||
(Version >= 7 || !p.Name.Equals(nameof(UseSso))) &&
|
||||
(
|
||||
!forHash ||
|
||||
(
|
||||
@ -175,7 +179,7 @@ namespace Bit.Core.Models.Business
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Version >= 1 && Version <= 6)
|
||||
if (Version >= 1 && Version <= 7)
|
||||
{
|
||||
return InstallationId == globalSettings.Installation.Id && SelfHost;
|
||||
}
|
||||
@ -192,7 +196,7 @@ namespace Bit.Core.Models.Business
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Version >= 1 && Version <= 6)
|
||||
if (Version >= 1 && Version <= 7)
|
||||
{
|
||||
var valid =
|
||||
globalSettings.Installation.Id == InstallationId &&
|
||||
@ -231,6 +235,11 @@ namespace Bit.Core.Models.Business
|
||||
{
|
||||
valid = organization.UsePolicies == UsePolicies;
|
||||
}
|
||||
|
||||
if (valid && Version >= 7)
|
||||
{
|
||||
valid = organization.UseSso == UseSso;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
Reference in New Issue
Block a user