mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[AC-2184] Fix push sync notification on opt-in to Flexible Collections (#3794)
* Fix push sync notification on opt-in to Flexible Collections * Fix tests * Fix tests more
This commit is contained in:
@ -899,8 +899,9 @@ public class OrganizationsController : Controller
|
||||
var orgUsers = await _organizationUserRepository.GetManyByOrganizationAsync(id, null);
|
||||
await Task.WhenAll(orgUsers
|
||||
.Where(ou => ou.UserId.HasValue &&
|
||||
ou.Status == OrganizationUserStatusType.Confirmed &&
|
||||
ou.Type is OrganizationUserType.Admin or OrganizationUserType.Owner)
|
||||
.Select(ou => _pushNotificationService.PushSyncVaultAsync(ou.UserId.Value)));
|
||||
.Select(ou => _pushNotificationService.PushSyncOrganizationsAsync(ou.UserId.Value)));
|
||||
}
|
||||
|
||||
private async Task TryGrantOwnerAccessToSecretsManagerAsync(Guid organizationId, Guid userId)
|
||||
|
@ -23,4 +23,6 @@ public enum PushType : byte
|
||||
|
||||
AuthRequest = 15,
|
||||
AuthRequestResponse = 16,
|
||||
|
||||
SyncOrganizations = 17,
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ public interface IPushNotificationService
|
||||
Task PushSyncFolderDeleteAsync(Folder folder);
|
||||
Task PushSyncCiphersAsync(Guid userId);
|
||||
Task PushSyncVaultAsync(Guid userId);
|
||||
Task PushSyncOrganizationsAsync(Guid userId);
|
||||
Task PushSyncOrgKeysAsync(Guid userId);
|
||||
Task PushSyncSettingsAsync(Guid userId);
|
||||
Task PushLogOutAsync(Guid userId, bool excludeCurrentContextFromPush = false);
|
||||
|
@ -106,6 +106,11 @@ public class AzureQueuePushNotificationService : IPushNotificationService
|
||||
await PushUserAsync(userId, PushType.SyncVault);
|
||||
}
|
||||
|
||||
public async Task PushSyncOrganizationsAsync(Guid userId)
|
||||
{
|
||||
await PushUserAsync(userId, PushType.SyncOrganizations);
|
||||
}
|
||||
|
||||
public async Task PushSyncOrgKeysAsync(Guid userId)
|
||||
{
|
||||
await PushUserAsync(userId, PushType.SyncOrgKeys);
|
||||
|
@ -105,6 +105,12 @@ public class MultiServicePushNotificationService : IPushNotificationService
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task PushSyncOrganizationsAsync(Guid userId)
|
||||
{
|
||||
PushToServices((s) => s.PushSyncOrganizationsAsync(userId));
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task PushSyncOrgKeysAsync(Guid userId)
|
||||
{
|
||||
PushToServices((s) => s.PushSyncOrgKeysAsync(userId));
|
||||
|
@ -117,6 +117,11 @@ public class NotificationHubPushNotificationService : IPushNotificationService
|
||||
await PushUserAsync(userId, PushType.SyncVault);
|
||||
}
|
||||
|
||||
public async Task PushSyncOrganizationsAsync(Guid userId)
|
||||
{
|
||||
await PushUserAsync(userId, PushType.SyncOrganizations);
|
||||
}
|
||||
|
||||
public async Task PushSyncOrgKeysAsync(Guid userId)
|
||||
{
|
||||
await PushUserAsync(userId, PushType.SyncOrgKeys);
|
||||
|
@ -113,6 +113,11 @@ public class NotificationsApiPushNotificationService : BaseIdentityClientService
|
||||
await PushUserAsync(userId, PushType.SyncVault);
|
||||
}
|
||||
|
||||
public async Task PushSyncOrganizationsAsync(Guid userId)
|
||||
{
|
||||
await PushUserAsync(userId, PushType.SyncOrganizations);
|
||||
}
|
||||
|
||||
public async Task PushSyncOrgKeysAsync(Guid userId)
|
||||
{
|
||||
await PushUserAsync(userId, PushType.SyncOrgKeys);
|
||||
|
@ -114,6 +114,11 @@ public class RelayPushNotificationService : BaseIdentityClientService, IPushNoti
|
||||
await PushUserAsync(userId, PushType.SyncVault);
|
||||
}
|
||||
|
||||
public async Task PushSyncOrganizationsAsync(Guid userId)
|
||||
{
|
||||
await PushUserAsync(userId, PushType.SyncOrganizations);
|
||||
}
|
||||
|
||||
public async Task PushSyncOrgKeysAsync(Guid userId)
|
||||
{
|
||||
await PushUserAsync(userId, PushType.SyncOrgKeys);
|
||||
|
@ -42,6 +42,11 @@ public class NoopPushNotificationService : IPushNotificationService
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task PushSyncOrganizationsAsync(Guid userId)
|
||||
{
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task PushSyncOrgKeysAsync(Guid userId)
|
||||
{
|
||||
return Task.FromResult(0);
|
||||
|
@ -50,6 +50,7 @@ public static class HubHelpers
|
||||
break;
|
||||
case PushType.SyncCiphers:
|
||||
case PushType.SyncVault:
|
||||
case PushType.SyncOrganizations:
|
||||
case PushType.SyncOrgKeys:
|
||||
case PushType.SyncSettings:
|
||||
case PushType.LogOut:
|
||||
|
Reference in New Issue
Block a user