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

PM-15084: Push notifications to installation id.

This enables the Notification Center created global notifications to be sent to affected devices of the same server installation. All clients connected to any of the server instance of that installation id would receive it.
This is useful for notifying all clients of an installation about upcoming maintenance.
This works both for Self-Hosted, but also for Cloud, assuming an installation id is set.
This commit is contained in:
Maciej Zieniuk
2024-11-25 18:05:29 +00:00
parent 181f3e4ae6
commit 49fe7c93fd
27 changed files with 808 additions and 152 deletions

View File

@ -13,12 +13,16 @@ public class PushSendRequestModel : IValidatableObject
public required PushType Type { get; set; }
public required object Payload { get; set; }
public ClientType? ClientType { get; set; }
public string? InstallationId { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (string.IsNullOrWhiteSpace(UserId) && string.IsNullOrWhiteSpace(OrganizationId))
if (string.IsNullOrWhiteSpace(UserId) &&
string.IsNullOrWhiteSpace(OrganizationId) &&
string.IsNullOrWhiteSpace(InstallationId))
{
yield return new ValidationResult($"{nameof(UserId)} or {nameof(OrganizationId)} is required.");
yield return new ValidationResult(
$"{nameof(UserId)} or {nameof(OrganizationId)} or {nameof(InstallationId)} is required.");
}
}
}