mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
[AC-1218] Add ability to delete Provider Portals (#3973)
* add new classes * initial commit * revert the changes on this files Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * revert unnecessary changes * Add a model * add the delete token endpoint * add a unit test for delete provider Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * add the delete provider method Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * resolve the failing test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * resolve the delete request redirect issue Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * changes to correct the json issue Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * resolve errors Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * resolve pr comment Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * move ProviderDeleteTokenable to the adminConsole Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * Add feature flag * resolve pr comments Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * add some unit test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * resolve the failing test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * resolve test Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * add the remove feature flag Signed-off-by: Cy Okeke <cokeke@bitwarden.com> * [AC-2378] Added `ProviderId` to PayPal transaction model (#3995) * Added ProviderId to PayPal transaction model * Fixed issue with parsing provider id * [AC-1923] Add endpoint to create client organization (#3977) * Add new endpoint for creating client organizations in consolidated billing * Create empty org and then assign seats for code re-use * Fixes made from debugging client side * few more small fixes * Vincent's feedback * Bumped version to 2024.4.1 (#3997) * [AC-1923] Add endpoint to create client organization (#3977) * Add new endpoint for creating client organizations in consolidated billing * Create empty org and then assign seats for code re-use * Fixes made from debugging client side * few more small fixes * Vincent's feedback * [AC-1923] Add endpoint to create client organization (#3977) * Add new endpoint for creating client organizations in consolidated billing * Create empty org and then assign seats for code re-use * Fixes made from debugging client side * few more small fixes * Vincent's feedback * add changes after merge conflict Signed-off-by: Cy Okeke <cokeke@bitwarden.com> --------- Signed-off-by: Cy Okeke <cokeke@bitwarden.com> Co-authored-by: Conner Turnbull <133619638+cturnbull-bitwarden@users.noreply.github.com> Co-authored-by: Alex Morask <144709477+amorask-bitwarden@users.noreply.github.com> Co-authored-by: Bitwarden DevOps <106330231+bitwarden-devops-bot@users.noreply.github.com>
This commit is contained in:
@ -15,4 +15,5 @@ public interface IApplicationCacheService
|
||||
Task UpsertOrganizationAbilityAsync(Organization organization);
|
||||
Task UpsertProviderAbilityAsync(Provider provider);
|
||||
Task DeleteOrganizationAbilityAsync(Guid organizationId);
|
||||
Task DeleteProviderAbilityAsync(Guid providerId);
|
||||
}
|
||||
|
@ -78,5 +78,6 @@ public interface IMailService
|
||||
Task SendSecretsManagerMaxServiceAccountLimitReachedEmailAsync(Organization organization, int maxSeatCount, IEnumerable<string> ownerEmails);
|
||||
Task SendTrustedDeviceAdminApprovalEmailAsync(string email, DateTime utcNow, string ip, string deviceTypeAndIdentifier);
|
||||
Task SendTrialInitiationEmailAsync(string email);
|
||||
Task SendInitiateDeletProviderEmailAsync(string email, Provider provider, string token);
|
||||
}
|
||||
|
||||
|
@ -267,6 +267,28 @@ public class HandlebarsMailService : IMailService
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendInitiateDeletProviderEmailAsync(string email, Provider provider, string token)
|
||||
{
|
||||
var message = CreateDefaultMessage("Request to Delete Your Provider", email);
|
||||
var model = new ProviderInitiateDeleteModel
|
||||
{
|
||||
Token = WebUtility.UrlEncode(token),
|
||||
WebVaultUrl = _globalSettings.BaseServiceUri.VaultWithHash,
|
||||
SiteName = _globalSettings.SiteName,
|
||||
ProviderId = provider.Id,
|
||||
ProviderName = CoreHelpers.SanitizeForEmail(provider.DisplayName(), false),
|
||||
ProviderNameUrlEncoded = WebUtility.UrlEncode(provider.Name),
|
||||
ProviderBillingEmail = provider.BillingEmail,
|
||||
ProviderCreationDate = provider.CreationDate.ToLongDateString(),
|
||||
ProviderCreationTime = provider.CreationDate.ToShortTimeString(),
|
||||
TimeZone = _utcTimeZoneDisplay,
|
||||
};
|
||||
await AddMessageContentAsync(message, "Provider.InitiateDeleteProvider", model);
|
||||
message.MetaData.Add("SendGridBypassListManagement", true);
|
||||
message.Category = "InitiateDeleteProvider";
|
||||
await _mailDeliveryService.SendEmailAsync(message);
|
||||
}
|
||||
|
||||
public async Task SendPasswordlessSignInAsync(string returnUrl, string token, string email)
|
||||
{
|
||||
var message = CreateDefaultMessage("[Admin] Continue Logging In", email);
|
||||
|
@ -85,6 +85,16 @@ public class InMemoryApplicationCacheService : IApplicationCacheService
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public virtual Task DeleteProviderAbilityAsync(Guid providerId)
|
||||
{
|
||||
if (_providerAbilities != null && _providerAbilities.ContainsKey(providerId))
|
||||
{
|
||||
_providerAbilities.Remove(providerId);
|
||||
}
|
||||
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
private async Task InitOrganizationAbilitiesAsync()
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
|
@ -64,4 +64,19 @@ public class InMemoryServiceBusApplicationCacheService : InMemoryApplicationCach
|
||||
{
|
||||
await base.DeleteOrganizationAbilityAsync(organizationId);
|
||||
}
|
||||
|
||||
public override async Task DeleteProviderAbilityAsync(Guid providerId)
|
||||
{
|
||||
await base.DeleteProviderAbilityAsync(providerId);
|
||||
var message = new ServiceBusMessage
|
||||
{
|
||||
Subject = _subName,
|
||||
ApplicationProperties =
|
||||
{
|
||||
{ "type", (byte)ApplicationCacheMessageType.DeleteProviderAbility },
|
||||
{ "id", providerId },
|
||||
}
|
||||
};
|
||||
var task = _topicMessageSender.SendMessageAsync(message);
|
||||
}
|
||||
}
|
||||
|
@ -268,5 +268,7 @@ public class NoopMailService : IMailService
|
||||
{
|
||||
return Task.FromResult(0);
|
||||
}
|
||||
|
||||
public Task SendInitiateDeletProviderEmailAsync(string email, Provider provider, string token) => throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user