mirror of
https://github.com/bitwarden/server
synced 2025-12-22 03:03:33 +00:00
* Fix typo in error message: 'Unkown' -> 'Unknown' * Fix typos in error message * Fix typo in example text: 'licence' -> 'license' * Fix typo in validation: 'Ooganization' -> 'Organization' * Fix typo in text string: 'compatibilty' -> 'compatibility' * Fix typo: 'ProviderDisllowedOrganizationTypes' -> 'ProviderDisallowedOrganizationTypes' * Fix typo: 'NSubstitueVersion' -> 'NSubstituteVersion' * Fix typo: 'CreateIntialInvite' -> 'CreateInitialInvite' * Fix typo: '_queuryScheme' -> '_queryScheme' * Fix typo: 'GetApplicationCacheServiceBusSubcriptionName' -> 'GetApplicationCacheServiceBusSubscriptionName' * Fix typo: 'metaDataRespository' -> 'metaDataRepository' * Fix typo: 'cipherAttachements' -> 'cipherAttachments' * Fix typo: 'savedEmergencyAccesss' -> 'savedEmergencyAccesses' * Fix typo: 'owerOrgUser' -> 'ownerOrgUser' * Fix typo: 'Organiation' -> 'Organization' * Fix typo: 'extistingUser' -> 'existingUser' * Fix typo: 'availibleAccess' -> 'availableAccess' * Fix typo: 'HasEnouphStorage' -> 'HasEnoughStorage' * Fix typo: 'extistingOrg' -> 'existingOrg' * Fix typo: 'subcriber' -> 'subscriber' * Fix typo: 'availibleCollections' -> 'availableCollections' * Fix typo: 'Succes' -> 'Success' * Fix typo: 'CreateAsync_UpdateWithCollecitons_Works' -> 'CreateAsync_UpdateWithCollections_Works' * Fix typo: 'BadInsallationId' -> 'BadInstallationId' * Fix typo: 'OrgNotFamiles' -> 'OrgNotFamilies' * Revert "Fix typo: 'Organiation' -> 'Organization'" This reverts commit8aadad1c25. * Revert "Fix typos in error message" This reverts commit81d201fc09. --------- Co-authored-by: Daniel James Smith <djsmith@web.de>
66 lines
2.2 KiB
C#
66 lines
2.2 KiB
C#
using Bit.Core.Entities;
|
|
using Bit.Core.Enums;
|
|
using Bit.Core.Repositories;
|
|
using Bit.Core.Settings;
|
|
using Bit.Core.Utilities;
|
|
using Microsoft.Azure.ServiceBus;
|
|
|
|
namespace Bit.Core.Services;
|
|
|
|
public class InMemoryServiceBusApplicationCacheService : InMemoryApplicationCacheService, IApplicationCacheService
|
|
{
|
|
private readonly TopicClient _topicClient;
|
|
private readonly string _subName;
|
|
|
|
public InMemoryServiceBusApplicationCacheService(
|
|
IOrganizationRepository organizationRepository,
|
|
IProviderRepository providerRepository,
|
|
GlobalSettings globalSettings)
|
|
: base(organizationRepository, providerRepository)
|
|
{
|
|
_subName = CoreHelpers.GetApplicationCacheServiceBusSubscriptionName(globalSettings);
|
|
_topicClient = new TopicClient(globalSettings.ServiceBus.ConnectionString,
|
|
globalSettings.ServiceBus.ApplicationCacheTopicName);
|
|
}
|
|
|
|
public override async Task UpsertOrganizationAbilityAsync(Organization organization)
|
|
{
|
|
await base.UpsertOrganizationAbilityAsync(organization);
|
|
var message = new Message
|
|
{
|
|
Label = _subName,
|
|
UserProperties =
|
|
{
|
|
{ "type", (byte)ApplicationCacheMessageType.UpsertOrganizationAbility },
|
|
{ "id", organization.Id },
|
|
}
|
|
};
|
|
var task = _topicClient.SendAsync(message);
|
|
}
|
|
|
|
public override async Task DeleteOrganizationAbilityAsync(Guid organizationId)
|
|
{
|
|
await base.DeleteOrganizationAbilityAsync(organizationId);
|
|
var message = new Message
|
|
{
|
|
Label = _subName,
|
|
UserProperties =
|
|
{
|
|
{ "type", (byte)ApplicationCacheMessageType.DeleteOrganizationAbility },
|
|
{ "id", organizationId },
|
|
}
|
|
};
|
|
var task = _topicClient.SendAsync(message);
|
|
}
|
|
|
|
public async Task BaseUpsertOrganizationAbilityAsync(Organization organization)
|
|
{
|
|
await base.UpsertOrganizationAbilityAsync(organization);
|
|
}
|
|
|
|
public async Task BaseDeleteOrganizationAbilityAsync(Guid organizationId)
|
|
{
|
|
await base.DeleteOrganizationAbilityAsync(organizationId);
|
|
}
|
|
}
|