1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

[EC-826] Merge license sync feature branch to master (#2587)

* [EC-634] Extract GenerateLicenseAsync to a query (#2373)

* [EC-637] Add license sync to server (#2453)

* [EC-1036] Show correct license sync date (#2626)

* Update method name per new pattern
This commit is contained in:
Thomas Rittson
2023-01-31 07:42:10 +10:00
committed by GitHub
parent d0355fcd12
commit 82908b1fb7
37 changed files with 746 additions and 123 deletions

View File

@ -0,0 +1,7 @@
namespace Bit.Core.Models.Api.OrganizationLicenses;
public class SelfHostedOrganizationLicenseRequestModel
{
public string LicenseKey { get; set; }
public string BillingSyncKey { get; set; }
}

View File

@ -1,9 +1,10 @@
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.Models.OrganizationConnectionConfigs;
namespace Bit.Core.Models.Data.Organizations.OrganizationConnections;
public class OrganizationConnectionData<T> where T : new()
public class OrganizationConnectionData<T> where T : IConnectionConfig
{
public Guid? Id { get; set; }
public OrganizationConnectionType Type { get; set; }

View File

@ -1,7 +1,20 @@
namespace Bit.Core.Models.OrganizationConnectionConfigs;
public class BillingSyncConfig
public class BillingSyncConfig : IConnectionConfig
{
public string BillingSyncKey { get; set; }
public Guid CloudOrganizationId { get; set; }
public DateTime? LastLicenseSync { get; set; }
public bool Validate(out string exception)
{
if (string.IsNullOrWhiteSpace(BillingSyncKey))
{
exception = "Failed to get Billing Sync Key";
return false;
}
exception = "";
return true;
}
}

View File

@ -0,0 +1,6 @@
namespace Bit.Core.Models.OrganizationConnectionConfigs;
public interface IConnectionConfig
{
bool Validate(out string exception);
}

View File

@ -3,9 +3,21 @@ using Bit.Core.Enums;
namespace Bit.Core.Models.OrganizationConnectionConfigs;
public class ScimConfig
public class ScimConfig : IConnectionConfig
{
public bool Enabled { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ScimProviderType? ScimProvider { get; set; }
public bool Validate(out string exception)
{
if (!Enabled)
{
exception = "Scim Config is disabled";
return false;
}
exception = "";
return true;
}
}