mirror of
https://github.com/bitwarden/server
synced 2026-01-29 15:53:36 +00:00
Add data models for scim and cloud billing sync to event integrations
This commit is contained in:
@@ -24,9 +24,21 @@ public class OrganizationIntegrationResponseModel : ResponseModel
|
||||
|
||||
public OrganizationIntegrationStatus Status => Type switch
|
||||
{
|
||||
// Not yet implemented, shouldn't be present, NotApplicable
|
||||
IntegrationType.CloudBillingSync => OrganizationIntegrationStatus.NotApplicable,
|
||||
IntegrationType.Scim => OrganizationIntegrationStatus.NotApplicable,
|
||||
// CloudBillingSync: Check if configuration exists and Enabled property is true
|
||||
// If null, invalid config, or Enabled is false, status is Invalid
|
||||
IntegrationType.CloudBillingSync => string.IsNullOrWhiteSpace(Configuration)
|
||||
? OrganizationIntegrationStatus.Invalid
|
||||
: (JsonSerializer.Deserialize<CloudBillingSyncIntegration>(Configuration)?.Enabled ?? false)
|
||||
? OrganizationIntegrationStatus.Completed
|
||||
: OrganizationIntegrationStatus.Invalid,
|
||||
|
||||
// Scim: Check if configuration exists and Enabled property is true
|
||||
// If null, invalid config, or Enabled is false, status is Invalid
|
||||
IntegrationType.Scim => string.IsNullOrWhiteSpace(Configuration)
|
||||
? OrganizationIntegrationStatus.Invalid
|
||||
: (JsonSerializer.Deserialize<ScimIntegration>(Configuration)?.Enabled ?? false)
|
||||
? OrganizationIntegrationStatus.Completed
|
||||
: OrganizationIntegrationStatus.Invalid,
|
||||
|
||||
// Webhook is allowed to be null. If it's present, it's Completed
|
||||
IntegrationType.Webhook => OrganizationIntegrationStatus.Completed,
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace Bit.Core.Dirt.Models.Data.EventIntegrations;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for CloudBillingSync integration type.
|
||||
/// </summary>
|
||||
public class CloudBillingSyncIntegration
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the billing sync integration is enabled.
|
||||
/// Replaces the separate Enabled column from OrganizationConnection.
|
||||
/// </summary>
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// API key for cloud billing synchronization.
|
||||
/// </summary>
|
||||
public string BillingSyncKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Reference to the cloud organization ID.
|
||||
/// </summary>
|
||||
public Guid CloudOrganizationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timestamp of the last successful license sync.
|
||||
/// </summary>
|
||||
public DateTime? LastLicenseSync { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Bit.Core.AdminConsole.Enums;
|
||||
|
||||
namespace Bit.Core.Dirt.Models.Data.EventIntegrations;
|
||||
|
||||
/// <summary>
|
||||
/// Configuration for SCIM integration type.
|
||||
/// </summary>
|
||||
public class ScimIntegration
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the SCIM integration is enabled.
|
||||
/// Replaces the separate Enabled column from OrganizationConnection.
|
||||
/// </summary>
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The SCIM provider type (e.g., Okta, Azure AD, OneLogin).
|
||||
/// </summary>
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public ScimProviderType? ScimProvider { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user