1
0
mirror of https://github.com/bitwarden/server synced 2025-12-25 12:43:14 +00:00

Merge branch 'master' into feature/flexible-collections

This commit is contained in:
Thomas Rittson
2023-09-26 10:40:26 +10:00
committed by GitHub
64 changed files with 7428 additions and 396 deletions

View File

@@ -19,6 +19,7 @@ using Bit.Core.Utilities;
using Bit.Core.Vault.Repositories;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Stripe;
namespace Bit.Admin.Controllers;
@@ -47,6 +48,7 @@ public class OrganizationsController : Controller
private readonly ISecretRepository _secretRepository;
private readonly IProjectRepository _projectRepository;
private readonly IServiceAccountRepository _serviceAccountRepository;
private readonly IStripeSyncService _stripeSyncService;
public OrganizationsController(
IOrganizationService organizationService,
@@ -70,7 +72,8 @@ public class OrganizationsController : Controller
ICurrentContext currentContext,
ISecretRepository secretRepository,
IProjectRepository projectRepository,
IServiceAccountRepository serviceAccountRepository)
IServiceAccountRepository serviceAccountRepository,
IStripeSyncService stripeSyncService)
{
_organizationService = organizationService;
_organizationRepository = organizationRepository;
@@ -94,6 +97,7 @@ public class OrganizationsController : Controller
_secretRepository = secretRepository;
_projectRepository = projectRepository;
_serviceAccountRepository = serviceAccountRepository;
_stripeSyncService = stripeSyncService;
}
[RequirePermission(Permission.Org_List_View)]
@@ -208,6 +212,16 @@ public class OrganizationsController : Controller
throw new BadRequestException("Plan does not support Secrets Manager");
}
try
{
await _stripeSyncService.UpdateCustomerEmailAddress(organization.GatewayCustomerId, organization.BillingEmail);
}
catch (StripeException stripeException)
{
_logger.LogError(stripeException, "Failed to update billing email address in Stripe for Organization with ID '{organizationId}'", organization.Id);
throw;
}
await _organizationRepository.ReplaceAsync(organization);
await _applicationCacheService.UpsertOrganizationAbilityAsync(organization);
await _referenceEventService.RaiseEventAsync(new ReferenceEvent(ReferenceEventType.OrganizationEditedByAdmin, organization, _currentContext)
@@ -215,6 +229,7 @@ public class OrganizationsController : Controller
EventRaisedByUser = _userService.GetUserName(User),
SalesAssistedTrialStarted = model.SalesAssistedTrialStarted,
});
return RedirectToAction("Edit", new { id });
}

View File

@@ -277,7 +277,13 @@
}
else
{
<input type="email" class="form-control" asp-for="BillingEmail" readonly='@(!canEditBilling)'>
<input
type="text"
class="form-control"
asp-for="BillingEmail"
readonly='@(!canEditBilling)'
pattern="@(@"[^@\s]+@[^@\s]+\.[^@\s]+")"
title="Email address must be in the format 'address@domain.com'.">
}
</div>
</div>

View File

@@ -178,10 +178,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2791,15 +2792,15 @@
"commercial.core": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )"
"Core": "[2023.9.0, )"
}
},
"commercial.infrastructure.entityframework": {
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
},
"core": {
@@ -2814,7 +2815,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",
@@ -2847,7 +2848,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Dapper": "[2.0.123, )"
}
},
@@ -2855,7 +2856,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
@@ -2867,7 +2868,7 @@
"migrator": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.Extensions.Logging": "[6.0.0, )",
"dbup-sqlserver": "[5.0.8, )"
}
@@ -2875,30 +2876,30 @@
"mysqlmigrations": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
},
"postgresmigrations": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
},
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.Dapper": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.Dapper": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
},
"sqlitemigrations": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
}
}

View File

@@ -281,10 +281,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2771,15 +2772,15 @@
"commercial.core": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )"
"Core": "[2023.9.0, )"
}
},
"commercial.infrastructure.entityframework": {
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
},
"core": {
@@ -2794,7 +2795,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",
@@ -2827,7 +2828,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Dapper": "[2.0.123, )"
}
},
@@ -2835,7 +2836,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
@@ -2847,9 +2848,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.Dapper": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.Dapper": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
}
}

View File

@@ -158,10 +158,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2597,7 +2598,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",
@@ -2630,7 +2631,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Dapper": "[2.0.123, )"
}
},
@@ -2638,7 +2639,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
@@ -2650,9 +2651,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.Dapper": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.Dapper": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
}
}

View File

@@ -36,8 +36,8 @@ public static class FeatureFlagKeys
public const string DisplayEuEnvironment = "display-eu-environment";
public const string DisplayLowKdfIterationWarning = "display-kdf-iteration-warning";
public const string TrustedDeviceEncryption = "trusted-device-encryption";
public const string SecretsManagerBilling = "sm-ga-billing";
public const string AutofillV2 = "autofill-v2";
public const string BrowserFilelessImport = "browser-fileless-import";
public static List<string> GetAllKeys()
{

View File

@@ -51,7 +51,7 @@
<PackageReference Include="Serilog.Sinks.AzureCosmosDB" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.SyslogMessages" Version="2.0.6" />
<PackageReference Include="AspNetCoreRateLimit" Version="4.0.2" />
<PackageReference Include="Braintree" Version="5.12.0" />
<PackageReference Include="Braintree" Version="5.19.0" />
<PackageReference Include="Stripe.net" Version="40.0.0" />
<PackageReference Include="Otp.NET" Version="1.2.2" />
<PackageReference Include="YubicoDotNetClient" Version="1.2.0" />

View File

@@ -1,5 +1,6 @@
using Bit.Core.Context;
using Bit.Core.Settings;
using LaunchDarkly.Logging;
using LaunchDarkly.Sdk.Server;
using LaunchDarkly.Sdk.Server.Integrations;
@@ -14,6 +15,7 @@ public class LaunchDarklyFeatureService : IFeatureService, IDisposable
IGlobalSettings globalSettings)
{
var ldConfig = Configuration.Builder(globalSettings.LaunchDarkly?.SdkKey);
ldConfig.Logging(Components.Logging().Level(LogLevel.Error));
if (string.IsNullOrEmpty(globalSettings.LaunchDarkly?.SdkKey))
{

View File

@@ -98,11 +98,12 @@
},
"Braintree": {
"type": "Direct",
"requested": "[5.12.0, )",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"requested": "[5.19.0, )",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},

View File

@@ -158,10 +158,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2597,7 +2598,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",
@@ -2630,7 +2631,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Dapper": "[2.0.123, )"
}
},
@@ -2638,7 +2639,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
@@ -2650,9 +2651,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.Dapper": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.Dapper": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
}
}

View File

@@ -158,10 +158,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2597,7 +2598,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",
@@ -2630,7 +2631,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Dapper": "[2.0.123, )"
}
},
@@ -2638,7 +2639,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
@@ -2650,9 +2651,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.Dapper": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.Dapper": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
}
}

View File

@@ -167,10 +167,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2606,7 +2607,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",
@@ -2639,7 +2640,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Dapper": "[2.0.123, )"
}
},
@@ -2647,7 +2648,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
@@ -2659,9 +2660,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.Dapper": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.Dapper": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
}
}

View File

@@ -167,10 +167,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2619,7 +2620,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",
@@ -2652,7 +2653,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Dapper": "[2.0.123, )"
}
},
@@ -2660,7 +2661,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
@@ -2672,9 +2673,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.Dapper": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.Dapper": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
}
}

View File

@@ -147,10 +147,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2439,7 +2440,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",

View File

@@ -144,27 +144,42 @@ public class OrganizationRepository : Repository<Core.Entities.Organization, Org
var dbContext = GetDatabaseContext(scope);
await dbContext.UserBumpAccountRevisionDateByOrganizationIdAsync(organization.Id);
var deleteCiphersTransaction = await dbContext.Database.BeginTransactionAsync();
dbContext.Ciphers.RemoveRange(
dbContext.Ciphers.Where(c => c.UserId == null && c.OrganizationId == organization.Id));
await dbContext.Ciphers.Where(c => c.UserId == null && c.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await deleteCiphersTransaction.CommitAsync();
var organizationDeleteTransaction = await dbContext.Database.BeginTransactionAsync();
dbContext.SsoUsers.RemoveRange(dbContext.SsoUsers.Where(su => su.OrganizationId == organization.Id));
dbContext.SsoConfigs.RemoveRange(dbContext.SsoConfigs.Where(sc => sc.OrganizationId == organization.Id));
var collectionUsers = from cu in dbContext.CollectionUsers
join ou in dbContext.OrganizationUsers on cu.OrganizationUserId equals ou.Id
where ou.OrganizationId == organization.Id
select cu;
dbContext.CollectionUsers.RemoveRange(collectionUsers);
dbContext.OrganizationUsers.RemoveRange(
dbContext.OrganizationUsers.Where(ou => ou.OrganizationId == organization.Id));
dbContext.ProviderOrganizations.RemoveRange(
dbContext.ProviderOrganizations.Where(po => po.OrganizationId == organization.Id));
await dbContext.SsoUsers.Where(su => su.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.SsoConfigs.Where(sc => sc.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.CollectionUsers.Where(cu => cu.OrganizationUser.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.UserProjectAccessPolicy.Where(ap => ap.OrganizationUser.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.UserServiceAccountAccessPolicy.Where(ap => ap.OrganizationUser.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.OrganizationUsers.Where(ou => ou.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.ProviderOrganizations.Where(po => po.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.GroupServiceAccountAccessPolicy.Where(ap => ap.GrantedServiceAccount.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.Project.Where(p => p.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.Secret.Where(s => s.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.ApiKeys.Where(ak => ak.ServiceAccount.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.ServiceAccount.Where(sa => sa.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
// The below section are 3 SPROCS in SQL Server but are only called by here
dbContext.OrganizationApiKeys.RemoveRange(
dbContext.OrganizationApiKeys.Where(oa => oa.OrganizationId == organization.Id));
dbContext.OrganizationConnections.RemoveRange(
dbContext.OrganizationConnections.Where(oc => oc.OrganizationId == organization.Id));
await dbContext.OrganizationApiKeys.Where(oa => oa.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
await dbContext.OrganizationConnections.Where(oc => oc.OrganizationId == organization.Id)
.ExecuteDeleteAsync();
var sponsoringOrgs = await dbContext.OrganizationSponsorships
.Where(os => os.SponsoringOrganizationId == organization.Id)
.ToListAsync();

View File

@@ -94,6 +94,11 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
.Where(gu => gu.OrganizationUserId == organizationUserId);
dbContext.GroupUsers.RemoveRange(groupUsers);
dbContext.UserProjectAccessPolicy.RemoveRange(
dbContext.UserProjectAccessPolicy.Where(ap => ap.OrganizationUserId == organizationUserId));
dbContext.UserServiceAccountAccessPolicy.RemoveRange(
dbContext.UserServiceAccountAccessPolicy.Where(ap => ap.OrganizationUserId == organizationUserId));
var orgSponsorships = await dbContext.OrganizationSponsorships
.Where(os => os.SponsoringOrganizationUserId == organizationUserId)
.ToListAsync();
@@ -328,7 +333,7 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
var userIds = users.Select(u => u.Id);
var userIdEntities = dbContext.OrganizationUsers.Where(x => userIds.Contains(x.Id));
// Query groups/collections separately to avoid cartesian explosion
// Query groups/collections separately to avoid cartesian explosion
if (includeGroups)
{
groups = (await (from gu in dbContext.GroupUsers

View File

@@ -167,6 +167,10 @@ public class UserRepository : Repository<Core.Entities.User, User, Guid>, IUserR
where ou.UserId == user.Id
select gu;
dbContext.GroupUsers.RemoveRange(groupUsers);
dbContext.UserProjectAccessPolicy.RemoveRange(
dbContext.UserProjectAccessPolicy.Where(ap => ap.OrganizationUser.UserId == user.Id));
dbContext.UserServiceAccountAccessPolicy.RemoveRange(
dbContext.UserServiceAccountAccessPolicy.Where(ap => ap.OrganizationUser.UserId == user.Id));
dbContext.OrganizationUsers.RemoveRange(dbContext.OrganizationUsers.Where(ou => ou.UserId == user.Id));
dbContext.ProviderUsers.RemoveRange(dbContext.ProviderUsers.Where(pu => pu.UserId == user.Id));
dbContext.SsoUsers.RemoveRange(dbContext.SsoUsers.Where(su => su.UserId == user.Id));

View File

@@ -39,6 +39,12 @@ public class UserProjectAccessPolicyEntityTypeConfiguration : IEntityTypeConfigu
builder
.Property(e => e.GrantedProjectId)
.HasColumnName(nameof(UserProjectAccessPolicy.GrantedProjectId));
builder
.HasOne(e => e.GrantedProject)
.WithMany(e => e.UserAccessPolicies)
.HasForeignKey(nameof(UserProjectAccessPolicy.GrantedProjectId))
.OnDelete(DeleteBehavior.Cascade);
}
}
@@ -67,6 +73,18 @@ public class GroupProjectAccessPolicyEntityTypeConfiguration : IEntityTypeConfig
builder
.Property(e => e.GrantedProjectId)
.HasColumnName(nameof(GroupProjectAccessPolicy.GrantedProjectId));
builder
.HasOne(e => e.GrantedProject)
.WithMany(e => e.GroupAccessPolicies)
.HasForeignKey(nameof(GroupProjectAccessPolicy.GrantedProjectId))
.OnDelete(DeleteBehavior.Cascade);
builder
.HasOne(e => e.Group)
.WithMany()
.HasForeignKey(nameof(GroupProjectAccessPolicy.GroupId))
.OnDelete(DeleteBehavior.Cascade);
}
}
@@ -81,6 +99,12 @@ public class GroupServiceAccountAccessPolicyEntityTypeConfiguration : IEntityTyp
builder
.Property(e => e.GrantedServiceAccountId)
.HasColumnName(nameof(GroupServiceAccountAccessPolicy.GrantedServiceAccountId));
builder
.HasOne(e => e.Group)
.WithMany()
.HasForeignKey(nameof(GroupProjectAccessPolicy.GroupId))
.OnDelete(DeleteBehavior.Cascade);
}
}
@@ -95,5 +119,11 @@ public class ServiceAccountProjectAccessPolicyEntityTypeConfiguration : IEntityT
builder
.Property(e => e.GrantedProjectId)
.HasColumnName(nameof(ServiceAccountProjectAccessPolicy.GrantedProjectId));
builder
.HasOne(e => e.GrantedProject)
.WithMany(e => e.ServiceAccountAccessPolicies)
.HasForeignKey(nameof(ServiceAccountProjectAccessPolicy.GrantedProjectId))
.OnDelete(DeleteBehavior.Cascade);
}
}

View File

@@ -221,10 +221,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2599,7 +2600,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",

View File

@@ -179,10 +179,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2647,7 +2648,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",
@@ -2680,7 +2681,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Dapper": "[2.0.123, )"
}
},
@@ -2688,7 +2689,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",
@@ -2700,9 +2701,9 @@
"sharedweb": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Infrastructure.Dapper": "[2023.8.3, )",
"Infrastructure.EntityFramework": "[2023.8.3, )"
"Core": "[2023.9.0, )",
"Infrastructure.Dapper": "[2023.9.0, )",
"Infrastructure.EntityFramework": "[2023.9.0, )"
}
}
}

View File

@@ -158,10 +158,11 @@
},
"Braintree": {
"type": "Transitive",
"resolved": "5.12.0",
"contentHash": "bV2tsVIvBQeKwULT4qPZUWhxSr8mFwyAAcvLDvDpCU0cMYPHzGSahha+ghUdgGMb317BqL34/Od59n2s3MkhOQ==",
"resolved": "5.19.0",
"contentHash": "B60wIX54g78nMsy5cJkvSfqs1VasYDXWFZQW0cUQ4QeW8Y5jPyBSaoxHwKC806lXUDaKC8kr5Y7Q6EdsBkPANQ==",
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"Microsoft.CSharp": "4.7.0",
"Newtonsoft.Json": "13.0.1",
"System.Xml.XPath.XmlDocument": "4.3.0"
}
},
@@ -2597,7 +2598,7 @@
"Azure.Storage.Blobs": "[12.14.1, )",
"Azure.Storage.Queues": "[12.12.0, )",
"BitPay.Light": "[1.0.1907, )",
"Braintree": "[5.12.0, )",
"Braintree": "[5.19.0, )",
"DnsClient": "[1.7.0, )",
"Fido2.AspNet": "[3.0.1, )",
"Handlebars.Net": "[2.1.2, )",
@@ -2630,7 +2631,7 @@
"infrastructure.dapper": {
"type": "Project",
"dependencies": {
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Dapper": "[2.0.123, )"
}
},
@@ -2638,7 +2639,7 @@
"type": "Project",
"dependencies": {
"AutoMapper.Extensions.Microsoft.DependencyInjection": "[12.0.1, )",
"Core": "[2023.8.3, )",
"Core": "[2023.9.0, )",
"Microsoft.EntityFrameworkCore.Relational": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.SqlServer": "[7.0.5, )",
"Microsoft.EntityFrameworkCore.Sqlite": "[7.0.5, )",