diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index f42f226153..d7814849c6 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"swashbuckle.aspnetcore.cli": {
- "version": "7.2.0",
+ "version": "7.3.2",
"commands": ["swagger"]
},
"dotnet-ef": {
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c6b0ecd9d0..e5c5d0e7a8 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -598,7 +598,7 @@ jobs:
uses: bitwarden/gh-actions/.github/workflows/_ephemeral_environment_manager.yml@main
with:
project: server
- pull_request_number: ${{ github.event.number }}
+ pull_request_number: ${{ github.event.number || 0 }}
secrets: inherit
permissions: read-all
diff --git a/bitwarden_license/src/Commercial.Core/Billing/Providers/Services/ProviderBillingService.cs b/bitwarden_license/src/Commercial.Core/Billing/Providers/Services/ProviderBillingService.cs
index 8c90d778bc..2b337fb4bb 100644
--- a/bitwarden_license/src/Commercial.Core/Billing/Providers/Services/ProviderBillingService.cs
+++ b/bitwarden_license/src/Commercial.Core/Billing/Providers/Services/ProviderBillingService.cs
@@ -550,6 +550,15 @@ public class ProviderBillingService(
[
new CustomerTaxIdDataOptions { Type = taxIdType, Value = taxInfo.TaxIdNumber }
];
+
+ if (taxIdType == StripeConstants.TaxIdType.SpanishNIF)
+ {
+ options.TaxIdData.Add(new CustomerTaxIdDataOptions
+ {
+ Type = StripeConstants.TaxIdType.EUVAT,
+ Value = $"ES{taxInfo.TaxIdNumber}"
+ });
+ }
}
if (!string.IsNullOrEmpty(provider.DiscountId))
diff --git a/dev/setup_azurite.ps1 b/dev/setup_azurite.ps1
index ad9808f6c3..03b92d4465 100755
--- a/dev/setup_azurite.ps1
+++ b/dev/setup_azurite.ps1
@@ -11,7 +11,7 @@ $corsRules = (@{
AllowedMethods = @("Get", "PUT");
});
$containers = "attachments", "sendfiles", "misc";
-$queues = "event", "notifications", "reference-events", "mail";
+$queues = "event", "notifications", "mail";
$tables = "event", "metadata", "installationdevice";
# End configuration
diff --git a/src/Admin/AdminConsole/Controllers/OrganizationsController.cs b/src/Admin/AdminConsole/Controllers/OrganizationsController.cs
index 6d38a77d8b..ecdd372df4 100644
--- a/src/Admin/AdminConsole/Controllers/OrganizationsController.cs
+++ b/src/Admin/AdminConsole/Controllers/OrganizationsController.cs
@@ -242,10 +242,32 @@ public class OrganizationsController : Controller
Seats = organization.Seats
};
+ if (model.PlanType.HasValue)
+ {
+ var freePlan = await _pricingClient.GetPlanOrThrow(model.PlanType.Value);
+ var isDowngradingToFree = organization.PlanType != PlanType.Free && model.PlanType.Value == PlanType.Free;
+ if (isDowngradingToFree)
+ {
+ if (model.Seats.HasValue && model.Seats.Value > freePlan.PasswordManager.MaxSeats)
+ {
+ TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxSeats} seats cannot be downgraded to the Free plan";
+ return RedirectToAction("Edit", new { id });
+ }
+
+ if (model.MaxCollections > freePlan.PasswordManager.MaxCollections)
+ {
+ TempData["Error"] = $"Organizations with more than {freePlan.PasswordManager.MaxCollections} collections cannot be downgraded to the Free plan. Your organization currently has {organization.MaxCollections} collections.";
+ return RedirectToAction("Edit", new { id });
+ }
+
+ model.MaxStorageGb = null;
+ model.ExpirationDate = null;
+ model.Enabled = true;
+ }
+ }
+
UpdateOrganization(organization, model);
-
var plan = await _pricingClient.GetPlanOrThrow(organization.PlanType);
-
if (organization.UseSecretsManager && !plan.SupportsSecretsManager)
{
TempData["Error"] = "Plan does not support Secrets Manager";
diff --git a/src/Api/Api.csproj b/src/Api/Api.csproj
index c490e90150..11af4d5e0a 100644
--- a/src/Api/Api.csproj
+++ b/src/Api/Api.csproj
@@ -34,7 +34,7 @@
-
+
diff --git a/src/Api/Billing/Controllers/OrganizationBillingController.cs b/src/Api/Billing/Controllers/OrganizationBillingController.cs
index 071aae5060..f1ab1be6bd 100644
--- a/src/Api/Billing/Controllers/OrganizationBillingController.cs
+++ b/src/Api/Billing/Controllers/OrganizationBillingController.cs
@@ -4,6 +4,7 @@ using Bit.Api.AdminConsole.Models.Request.Organizations;
using Bit.Api.Billing.Models.Requests;
using Bit.Api.Billing.Models.Responses;
using Bit.Api.Billing.Queries.Organizations;
+using Bit.Core.Billing.Enums;
using Bit.Core.Billing.Models;
using Bit.Core.Billing.Models.Sales;
using Bit.Core.Billing.Pricing;
@@ -280,17 +281,36 @@ public class OrganizationBillingController(
}
var organization = await organizationRepository.GetByIdAsync(organizationId);
-
if (organization == null)
{
return Error.NotFound();
}
+ var existingPlan = organization.PlanType;
var organizationSignup = model.ToOrganizationSignup(user);
var sale = OrganizationSale.From(organization, organizationSignup);
var plan = await pricingClient.GetPlanOrThrow(model.PlanType);
sale.Organization.PlanType = plan.Type;
sale.Organization.Plan = plan.Name;
sale.SubscriptionSetup.SkipTrial = true;
+ if (existingPlan == PlanType.Free && organization.GatewaySubscriptionId is not null)
+ {
+ sale.Organization.UseTotp = plan.HasTotp;
+ sale.Organization.UseGroups = plan.HasGroups;
+ sale.Organization.UseDirectory = plan.HasDirectory;
+ sale.Organization.SelfHost = plan.HasSelfHost;
+ sale.Organization.UsersGetPremium = plan.UsersGetPremium;
+ sale.Organization.UseEvents = plan.HasEvents;
+ sale.Organization.Use2fa = plan.Has2fa;
+ sale.Organization.UseApi = plan.HasApi;
+ sale.Organization.UsePolicies = plan.HasPolicies;
+ sale.Organization.UseSso = plan.HasSso;
+ sale.Organization.UseResetPassword = plan.HasResetPassword;
+ sale.Organization.UseKeyConnector = plan.HasKeyConnector;
+ sale.Organization.UseScim = plan.HasScim;
+ sale.Organization.UseCustomPermissions = plan.HasCustomPermissions;
+ sale.Organization.UseOrganizationDomains = plan.HasOrganizationDomains;
+ sale.Organization.MaxCollections = plan.PasswordManager.MaxCollections;
+ }
if (organizationSignup.PaymentMethodType == null || string.IsNullOrEmpty(organizationSignup.PaymentToken))
{
diff --git a/src/Api/Dirt/Controllers/HibpController.cs b/src/Api/Dirt/Controllers/HibpController.cs
index f12027cb31..e0ec40d0ab 100644
--- a/src/Api/Dirt/Controllers/HibpController.cs
+++ b/src/Api/Dirt/Controllers/HibpController.cs
@@ -8,7 +8,7 @@ using Bit.Core.Utilities;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-namespace Bit.Api.Tools.Controllers;
+namespace Bit.Api.Dirt.Controllers;
[Route("hibp")]
[Authorize("Application")]
diff --git a/src/Api/Dirt/Controllers/ReportsController.cs b/src/Api/Dirt/Controllers/ReportsController.cs
index 4c0a802da2..2f7a5a4328 100644
--- a/src/Api/Dirt/Controllers/ReportsController.cs
+++ b/src/Api/Dirt/Controllers/ReportsController.cs
@@ -1,16 +1,16 @@
-using Bit.Api.Tools.Models;
-using Bit.Api.Tools.Models.Response;
+using Bit.Api.Dirt.Models;
+using Bit.Api.Dirt.Models.Response;
using Bit.Core.Context;
+using Bit.Core.Dirt.Reports.Entities;
+using Bit.Core.Dirt.Reports.Models.Data;
+using Bit.Core.Dirt.Reports.ReportFeatures.Interfaces;
+using Bit.Core.Dirt.Reports.ReportFeatures.OrganizationReportMembers.Interfaces;
+using Bit.Core.Dirt.Reports.ReportFeatures.Requests;
using Bit.Core.Exceptions;
-using Bit.Core.Tools.Entities;
-using Bit.Core.Tools.Models.Data;
-using Bit.Core.Tools.ReportFeatures.Interfaces;
-using Bit.Core.Tools.ReportFeatures.OrganizationReportMembers.Interfaces;
-using Bit.Core.Tools.ReportFeatures.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-namespace Bit.Api.Tools.Controllers;
+namespace Bit.Api.Dirt.Controllers;
[Route("reports")]
[Authorize("Application")]
@@ -47,7 +47,7 @@ public class ReportsController : Controller
[HttpGet("member-cipher-details/{orgId}")]
public async Task> GetMemberCipherDetails(Guid orgId)
{
- // Using the AccessReports permission here until new permissions
+ // Using the AccessReports permission here until new permissions
// are needed for more control over reports
if (!await _currentContext.AccessReports(orgId))
{
@@ -84,7 +84,7 @@ public class ReportsController : Controller
}
///
- /// Contains the organization member info, the cipher ids associated with the member,
+ /// Contains the organization member info, the cipher ids associated with the member,
/// and details on their collections, groups, and permissions
///
/// Request to the MemberAccessCipherDetailsQuery
diff --git a/src/Api/Dirt/Models/PasswordHealthReportApplicationModel.cs b/src/Api/Dirt/Models/PasswordHealthReportApplicationModel.cs
index 93467e1175..5dbc07afb5 100644
--- a/src/Api/Dirt/Models/PasswordHealthReportApplicationModel.cs
+++ b/src/Api/Dirt/Models/PasswordHealthReportApplicationModel.cs
@@ -1,4 +1,4 @@
-namespace Bit.Api.Tools.Models;
+namespace Bit.Api.Dirt.Models;
public class PasswordHealthReportApplicationModel
{
diff --git a/src/Api/Dirt/Models/Response/MemberAccessReportModel.cs b/src/Api/Dirt/Models/Response/MemberAccessReportModel.cs
index b110c316c1..b8356e5d44 100644
--- a/src/Api/Dirt/Models/Response/MemberAccessReportModel.cs
+++ b/src/Api/Dirt/Models/Response/MemberAccessReportModel.cs
@@ -1,10 +1,10 @@
-using Bit.Core.Tools.Models.Data;
+using Bit.Core.Dirt.Reports.Models.Data;
-namespace Bit.Api.Tools.Models.Response;
+namespace Bit.Api.Dirt.Models.Response;
///
/// Contains the collections and group collections a user has access to including
-/// the permission level for the collection and group collection.
+/// the permission level for the collection and group collection.
///
public class MemberAccessReportResponseModel
{
diff --git a/src/Api/Dirt/Models/Response/MemberCipherDetailsResponseModel.cs b/src/Api/Dirt/Models/Response/MemberCipherDetailsResponseModel.cs
index d927da8123..30065ad05a 100644
--- a/src/Api/Dirt/Models/Response/MemberCipherDetailsResponseModel.cs
+++ b/src/Api/Dirt/Models/Response/MemberCipherDetailsResponseModel.cs
@@ -1,6 +1,6 @@
-using Bit.Core.Tools.Models.Data;
+using Bit.Core.Dirt.Reports.Models.Data;
-namespace Bit.Api.Tools.Models.Response;
+namespace Bit.Api.Dirt.Models.Response;
public class MemberCipherDetailsResponseModel
{
diff --git a/src/Api/Startup.cs b/src/Api/Startup.cs
index e24f96a7a9..c2a75c9278 100644
--- a/src/Api/Startup.cs
+++ b/src/Api/Startup.cs
@@ -31,8 +31,8 @@ using Bit.Api.Billing;
using Bit.Core.Auth.Models.Data;
using Bit.Core.Auth.Identity.TokenProviders;
using Bit.Core.Tools.ImportFeatures;
-using Bit.Core.Tools.ReportFeatures;
using Bit.Core.Auth.Models.Api.Request;
+using Bit.Core.Dirt.Reports.ReportFeatures;
using Bit.Core.Tools.SendFeatures;
#if !OSS
diff --git a/src/Api/Vault/Controllers/CiphersController.cs b/src/Api/Vault/Controllers/CiphersController.cs
index 7b302f3724..5991d0babb 100644
--- a/src/Api/Vault/Controllers/CiphersController.cs
+++ b/src/Api/Vault/Controllers/CiphersController.cs
@@ -42,7 +42,6 @@ public class CiphersController : Controller
private readonly ICurrentContext _currentContext;
private readonly ILogger _logger;
private readonly GlobalSettings _globalSettings;
- private readonly IFeatureService _featureService;
private readonly IOrganizationCiphersQuery _organizationCiphersQuery;
private readonly IApplicationCacheService _applicationCacheService;
private readonly ICollectionRepository _collectionRepository;
@@ -57,7 +56,6 @@ public class CiphersController : Controller
ICurrentContext currentContext,
ILogger logger,
GlobalSettings globalSettings,
- IFeatureService featureService,
IOrganizationCiphersQuery organizationCiphersQuery,
IApplicationCacheService applicationCacheService,
ICollectionRepository collectionRepository)
@@ -71,7 +69,6 @@ public class CiphersController : Controller
_currentContext = currentContext;
_logger = logger;
_globalSettings = globalSettings;
- _featureService = featureService;
_organizationCiphersQuery = organizationCiphersQuery;
_applicationCacheService = applicationCacheService;
_collectionRepository = collectionRepository;
@@ -375,11 +372,6 @@ public class CiphersController : Controller
private async Task CanDeleteOrRestoreCipherAsAdminAsync(Guid organizationId, IEnumerable cipherIds)
{
- if (!_featureService.IsEnabled(FeatureFlagKeys.LimitItemDeletion))
- {
- return await CanEditCipherAsAdminAsync(organizationId, cipherIds);
- }
-
var org = _currentContext.GetOrganization(organizationId);
// If we're not an "admin" or if we're a provider user we don't need to check the ciphers
diff --git a/src/Api/Vault/Controllers/SecurityTaskController.cs b/src/Api/Vault/Controllers/SecurityTaskController.cs
index 2fe1025ba7..d94c9a9a92 100644
--- a/src/Api/Vault/Controllers/SecurityTaskController.cs
+++ b/src/Api/Vault/Controllers/SecurityTaskController.cs
@@ -1,9 +1,7 @@
using Bit.Api.Models.Response;
using Bit.Api.Vault.Models.Request;
using Bit.Api.Vault.Models.Response;
-using Bit.Core;
using Bit.Core.Services;
-using Bit.Core.Utilities;
using Bit.Core.Vault.Commands.Interfaces;
using Bit.Core.Vault.Entities;
using Bit.Core.Vault.Enums;
@@ -15,7 +13,6 @@ namespace Bit.Api.Vault.Controllers;
[Route("tasks")]
[Authorize("Application")]
-[RequireFeature(FeatureFlagKeys.SecurityTasks)]
public class SecurityTaskController : Controller
{
private readonly IUserService _userService;
diff --git a/src/Billing/Billing.csproj b/src/Billing/Billing.csproj
index 01a8bbdd9b..116efdb68c 100644
--- a/src/Billing/Billing.csproj
+++ b/src/Billing/Billing.csproj
@@ -10,7 +10,7 @@
-
+
diff --git a/src/Core/AdminConsole/Enums/PolicyType.cs b/src/Core/AdminConsole/Enums/PolicyType.cs
index 6f3bcd0102..f72637f862 100644
--- a/src/Core/AdminConsole/Enums/PolicyType.cs
+++ b/src/Core/AdminConsole/Enums/PolicyType.cs
@@ -17,6 +17,7 @@ public enum PolicyType : byte
AutomaticAppLogIn = 12,
FreeFamiliesSponsorshipPolicy = 13,
RemoveUnlockWithPin = 14,
+ RestrictedItemTypesPolicy = 15,
}
public static class PolicyTypeExtensions
@@ -43,7 +44,8 @@ public static class PolicyTypeExtensions
PolicyType.ActivateAutofill => "Active auto-fill",
PolicyType.AutomaticAppLogIn => "Automatically log in users for allowed applications",
PolicyType.FreeFamiliesSponsorshipPolicy => "Remove Free Bitwarden Families sponsorship",
- PolicyType.RemoveUnlockWithPin => "Remove unlock with PIN"
+ PolicyType.RemoveUnlockWithPin => "Remove unlock with PIN",
+ PolicyType.RestrictedItemTypesPolicy => "Restricted item types",
};
}
}
diff --git a/src/Core/Billing/Constants/StripeConstants.cs b/src/Core/Billing/Constants/StripeConstants.cs
index 28f4dea4b2..0cffad72d3 100644
--- a/src/Core/Billing/Constants/StripeConstants.cs
+++ b/src/Core/Billing/Constants/StripeConstants.cs
@@ -96,6 +96,12 @@ public static class StripeConstants
public const string Reverse = "reverse";
}
+ public static class TaxIdType
+ {
+ public const string EUVAT = "eu_vat";
+ public const string SpanishNIF = "es_cif";
+ }
+
public static class ValidateTaxLocationTiming
{
public const string Deferred = "deferred";
diff --git a/src/Core/Billing/Pricing/PlanAdapter.cs b/src/Core/Billing/Pricing/PlanAdapter.cs
index f719fd1e87..45a48c3f80 100644
--- a/src/Core/Billing/Pricing/PlanAdapter.cs
+++ b/src/Core/Billing/Pricing/PlanAdapter.cs
@@ -31,6 +31,7 @@ public record PlanAdapter : Plan
HasScim = HasFeature("scim");
HasResetPassword = HasFeature("resetPassword");
UsersGetPremium = HasFeature("usersGetPremium");
+ HasCustomPermissions = HasFeature("customPermissions");
UpgradeSortOrder = plan.AdditionalData.TryGetValue("upgradeSortOrder", out var upgradeSortOrder)
? int.Parse(upgradeSortOrder)
: 0;
@@ -141,6 +142,7 @@ public record PlanAdapter : Plan
var stripeSeatPlanId = GetStripeSeatPlanId(seats);
var hasAdditionalSeatsOption = seats.IsScalable;
var seatPrice = GetSeatPrice(seats);
+ var baseSeats = GetBaseSeats(seats);
var maxSeats = GetMaxSeats(seats);
var allowSeatAutoscale = seats.IsScalable;
var maxProjects = plan.AdditionalData.TryGetValue("secretsManager.maxProjects", out var value) ? short.Parse(value) : 0;
@@ -156,6 +158,7 @@ public record PlanAdapter : Plan
StripeSeatPlanId = stripeSeatPlanId,
HasAdditionalSeatsOption = hasAdditionalSeatsOption,
SeatPrice = seatPrice,
+ BaseSeats = baseSeats,
MaxSeats = maxSeats,
AllowSeatAutoscale = allowSeatAutoscale,
MaxProjects = maxProjects
@@ -168,8 +171,16 @@ public record PlanAdapter : Plan
private static decimal GetBasePrice(PurchasableDTO purchasable)
=> purchasable.FromPackaged(x => x.Price);
+ private static int GetBaseSeats(FreeOrScalableDTO freeOrScalable)
+ => freeOrScalable.Match(
+ free => free.Quantity,
+ scalable => scalable.Provided);
+
private static int GetBaseSeats(PurchasableDTO purchasable)
- => purchasable.FromPackaged(x => x.Quantity);
+ => purchasable.Match(
+ free => free.Quantity,
+ packaged => packaged.Quantity,
+ scalable => scalable.Provided);
private static short GetBaseServiceAccount(FreeOrScalableDTO freeOrScalable)
=> freeOrScalable.Match(
diff --git a/src/Core/Billing/Services/Implementations/OrganizationBillingService.cs b/src/Core/Billing/Services/Implementations/OrganizationBillingService.cs
index c647e825b6..5e59d0d108 100644
--- a/src/Core/Billing/Services/Implementations/OrganizationBillingService.cs
+++ b/src/Core/Billing/Services/Implementations/OrganizationBillingService.cs
@@ -78,13 +78,14 @@ public class OrganizationBillingService(
var isEligibleForSelfHost = await IsEligibleForSelfHostAsync(organization);
var isManaged = organization.Status == OrganizationStatusType.Managed;
-
+ var orgOccupiedSeats = await organizationUserRepository.GetOccupiedSeatCountByOrganizationIdAsync(organization.Id);
if (string.IsNullOrWhiteSpace(organization.GatewaySubscriptionId))
{
return OrganizationMetadata.Default with
{
IsEligibleForSelfHost = isEligibleForSelfHost,
- IsManaged = isManaged
+ IsManaged = isManaged,
+ OrganizationOccupiedSeats = orgOccupiedSeats
};
}
@@ -108,8 +109,6 @@ public class OrganizationBillingService(
? await stripeAdapter.InvoiceGetAsync(subscription.LatestInvoiceId, new InvoiceGetOptions())
: null;
- var orgOccupiedSeats = await organizationUserRepository.GetOccupiedSeatCountByOrganizationIdAsync(organization.Id);
-
return new OrganizationMetadata(
isEligibleForSelfHost,
isManaged,
@@ -248,12 +247,23 @@ public class OrganizationBillingService(
organization.Id,
customerSetup.TaxInformation.Country,
customerSetup.TaxInformation.TaxId);
+
+ throw new BadRequestException("billingTaxIdTypeInferenceError");
}
customerCreateOptions.TaxIdData =
[
new() { Type = taxIdType, Value = customerSetup.TaxInformation.TaxId }
];
+
+ if (taxIdType == StripeConstants.TaxIdType.SpanishNIF)
+ {
+ customerCreateOptions.TaxIdData.Add(new CustomerTaxIdDataOptions
+ {
+ Type = StripeConstants.TaxIdType.EUVAT,
+ Value = $"ES{customerSetup.TaxInformation.TaxId}"
+ });
+ }
}
var (paymentMethodType, paymentMethodToken) = customerSetup.TokenizedPaymentSource;
@@ -420,7 +430,7 @@ public class OrganizationBillingService(
var setNonUSBusinessUseToReverseCharge =
featureService.IsEnabled(FeatureFlagKeys.PM21092_SetNonUSBusinessUseToReverseCharge);
- if (setNonUSBusinessUseToReverseCharge)
+ if (setNonUSBusinessUseToReverseCharge && customer.HasBillingLocation())
{
subscriptionCreateOptions.AutomaticTax = new SubscriptionAutomaticTaxOptions { Enabled = true };
}
diff --git a/src/Core/Billing/Services/Implementations/SubscriberService.cs b/src/Core/Billing/Services/Implementations/SubscriberService.cs
index 75a1bf76ec..796f700e9f 100644
--- a/src/Core/Billing/Services/Implementations/SubscriberService.cs
+++ b/src/Core/Billing/Services/Implementations/SubscriberService.cs
@@ -648,6 +648,12 @@ public class SubscriberService(
{
await stripeAdapter.TaxIdCreateAsync(customer.Id,
new TaxIdCreateOptions { Type = taxIdType, Value = taxInformation.TaxId });
+
+ if (taxIdType == StripeConstants.TaxIdType.SpanishNIF)
+ {
+ await stripeAdapter.TaxIdCreateAsync(customer.Id,
+ new TaxIdCreateOptions { Type = StripeConstants.TaxIdType.EUVAT, Value = $"ES{taxInformation.TaxId}" });
+ }
}
catch (StripeException e)
{
diff --git a/src/Core/Billing/Tax/Commands/PreviewTaxAmountCommand.cs b/src/Core/Billing/Tax/Commands/PreviewTaxAmountCommand.cs
index 304abbaae0..c777d0c0d1 100644
--- a/src/Core/Billing/Tax/Commands/PreviewTaxAmountCommand.cs
+++ b/src/Core/Billing/Tax/Commands/PreviewTaxAmountCommand.cs
@@ -80,6 +80,15 @@ public class PreviewTaxAmountCommand(
Value = taxInformation.TaxId
}
];
+
+ if (taxIdType == StripeConstants.TaxIdType.SpanishNIF)
+ {
+ options.CustomerDetails.TaxIds.Add(new InvoiceCustomerDetailsTaxIdOptions
+ {
+ Type = StripeConstants.TaxIdType.EUVAT,
+ Value = $"ES{parameters.TaxInformation.TaxId}"
+ });
+ }
}
if (planType.GetProductTier() == ProductTierType.Families)
diff --git a/src/Core/Constants.cs b/src/Core/Constants.cs
index e6a822452a..49d360ec50 100644
--- a/src/Core/Constants.cs
+++ b/src/Core/Constants.cs
@@ -181,6 +181,8 @@ public static class FeatureFlagKeys
public const string EnablePMFlightRecorder = "enable-pm-flight-recorder";
public const string MobileErrorReporting = "mobile-error-reporting";
public const string AndroidChromeAutofill = "android-chrome-autofill";
+ public const string EnablePMPreloginSettings = "enable-pm-prelogin-settings";
+ public const string AppIntents = "app-intents";
/* Platform Team */
public const string PersistPopupView = "persist-popup-view";
diff --git a/src/Core/Dirt/Reports/Entities/PasswordHealthReportApplication.cs b/src/Core/Dirt/Reports/Entities/PasswordHealthReportApplication.cs
index 9d89edf633..db605d6b74 100644
--- a/src/Core/Dirt/Reports/Entities/PasswordHealthReportApplication.cs
+++ b/src/Core/Dirt/Reports/Entities/PasswordHealthReportApplication.cs
@@ -1,9 +1,9 @@
-using Bit.Core.Entities;
+#nullable enable
+
+using Bit.Core.Entities;
using Bit.Core.Utilities;
-#nullable enable
-
-namespace Bit.Core.Tools.Entities;
+namespace Bit.Core.Dirt.Reports.Entities;
public class PasswordHealthReportApplication : ITableObject, IRevisable
{
diff --git a/src/Core/Dirt/Reports/Models/Data/MemberAccessCipherDetails.cs b/src/Core/Dirt/Reports/Models/Data/MemberAccessCipherDetails.cs
index 943d56c53e..759337d5cf 100644
--- a/src/Core/Dirt/Reports/Models/Data/MemberAccessCipherDetails.cs
+++ b/src/Core/Dirt/Reports/Models/Data/MemberAccessCipherDetails.cs
@@ -1,4 +1,4 @@
-namespace Bit.Core.Tools.Models.Data;
+namespace Bit.Core.Dirt.Reports.Models.Data;
public class MemberAccessDetails
{
@@ -30,13 +30,13 @@ public class MemberAccessCipherDetails
public bool UsesKeyConnector { get; set; }
///
- /// The details for the member's collection access depending
- /// on the collections and groups they are assigned to
+ /// The details for the member's collection access depending
+ /// on the collections and groups they are assigned to
///
public IEnumerable AccessDetails { get; set; }
///
- /// A distinct list of the cipher ids associated with
+ /// A distinct list of the cipher ids associated with
/// the organization member
///
public IEnumerable CipherIds { get; set; }
diff --git a/src/Core/Dirt/Reports/ReportFeatures/AddPasswordHealthReportApplicationCommand.cs b/src/Core/Dirt/Reports/ReportFeatures/AddPasswordHealthReportApplicationCommand.cs
index b191799ba0..f8232ffa92 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/AddPasswordHealthReportApplicationCommand.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/AddPasswordHealthReportApplicationCommand.cs
@@ -1,11 +1,11 @@
-using Bit.Core.Exceptions;
+using Bit.Core.Dirt.Reports.Entities;
+using Bit.Core.Dirt.Reports.ReportFeatures.Interfaces;
+using Bit.Core.Dirt.Reports.ReportFeatures.Requests;
+using Bit.Core.Dirt.Reports.Repositories;
+using Bit.Core.Exceptions;
using Bit.Core.Repositories;
-using Bit.Core.Tools.Entities;
-using Bit.Core.Tools.ReportFeatures.Interfaces;
-using Bit.Core.Tools.ReportFeatures.Requests;
-using Bit.Core.Tools.Repositories;
-namespace Bit.Core.Tools.ReportFeatures;
+namespace Bit.Core.Dirt.Reports.ReportFeatures;
public class AddPasswordHealthReportApplicationCommand : IAddPasswordHealthReportApplicationCommand
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/DropPasswordHealthReportApplicationCommand.cs b/src/Core/Dirt/Reports/ReportFeatures/DropPasswordHealthReportApplicationCommand.cs
index 73a8f84e6a..55914dca37 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/DropPasswordHealthReportApplicationCommand.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/DropPasswordHealthReportApplicationCommand.cs
@@ -1,9 +1,9 @@
-using Bit.Core.Exceptions;
-using Bit.Core.Tools.ReportFeatures.Interfaces;
-using Bit.Core.Tools.ReportFeatures.Requests;
-using Bit.Core.Tools.Repositories;
+using Bit.Core.Dirt.Reports.ReportFeatures.Interfaces;
+using Bit.Core.Dirt.Reports.ReportFeatures.Requests;
+using Bit.Core.Dirt.Reports.Repositories;
+using Bit.Core.Exceptions;
-namespace Bit.Core.Tools.ReportFeatures;
+namespace Bit.Core.Dirt.Reports.ReportFeatures;
public class DropPasswordHealthReportApplicationCommand : IDropPasswordHealthReportApplicationCommand
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/GetPasswordHealthReportApplicationQuery.cs b/src/Core/Dirt/Reports/ReportFeatures/GetPasswordHealthReportApplicationQuery.cs
index 5baf5b2f72..d9b5e79a0c 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/GetPasswordHealthReportApplicationQuery.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/GetPasswordHealthReportApplicationQuery.cs
@@ -1,9 +1,9 @@
-using Bit.Core.Exceptions;
-using Bit.Core.Tools.Entities;
-using Bit.Core.Tools.ReportFeatures.Interfaces;
-using Bit.Core.Tools.Repositories;
+using Bit.Core.Dirt.Reports.Entities;
+using Bit.Core.Dirt.Reports.ReportFeatures.Interfaces;
+using Bit.Core.Dirt.Reports.Repositories;
+using Bit.Core.Exceptions;
-namespace Bit.Core.Tools.ReportFeatures;
+namespace Bit.Core.Dirt.Reports.ReportFeatures;
public class GetPasswordHealthReportApplicationQuery : IGetPasswordHealthReportApplicationQuery
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IAddPasswordHealthReportApplicationCommand.cs b/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IAddPasswordHealthReportApplicationCommand.cs
index 9d145a79b6..0a4aa29f2f 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IAddPasswordHealthReportApplicationCommand.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IAddPasswordHealthReportApplicationCommand.cs
@@ -1,7 +1,7 @@
-using Bit.Core.Tools.Entities;
-using Bit.Core.Tools.ReportFeatures.Requests;
+using Bit.Core.Dirt.Reports.Entities;
+using Bit.Core.Dirt.Reports.ReportFeatures.Requests;
-namespace Bit.Core.Tools.ReportFeatures.Interfaces;
+namespace Bit.Core.Dirt.Reports.ReportFeatures.Interfaces;
public interface IAddPasswordHealthReportApplicationCommand
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IDropPasswordHealthReportApplicationCommand.cs b/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IDropPasswordHealthReportApplicationCommand.cs
index 0adf09cab8..8e97e32ac7 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IDropPasswordHealthReportApplicationCommand.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IDropPasswordHealthReportApplicationCommand.cs
@@ -1,6 +1,6 @@
-using Bit.Core.Tools.ReportFeatures.Requests;
+using Bit.Core.Dirt.Reports.ReportFeatures.Requests;
-namespace Bit.Core.Tools.ReportFeatures.Interfaces;
+namespace Bit.Core.Dirt.Reports.ReportFeatures.Interfaces;
public interface IDropPasswordHealthReportApplicationCommand
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IGetPasswordHealthReportApplicationQuery.cs b/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IGetPasswordHealthReportApplicationQuery.cs
index f24119c2b7..ae2f759756 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IGetPasswordHealthReportApplicationQuery.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/Interfaces/IGetPasswordHealthReportApplicationQuery.cs
@@ -1,6 +1,6 @@
-using Bit.Core.Tools.Entities;
+using Bit.Core.Dirt.Reports.Entities;
-namespace Bit.Core.Tools.ReportFeatures.Interfaces;
+namespace Bit.Core.Dirt.Reports.ReportFeatures.Interfaces;
public interface IGetPasswordHealthReportApplicationQuery
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/MemberAccessCipherDetailsQuery.cs b/src/Core/Dirt/Reports/ReportFeatures/MemberAccessCipherDetailsQuery.cs
index 0c165a7dc2..4a8039e6bc 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/MemberAccessCipherDetailsQuery.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/MemberAccessCipherDetailsQuery.cs
@@ -2,21 +2,21 @@
using Bit.Core.AdminConsole.Entities;
using Bit.Core.AdminConsole.Repositories;
using Bit.Core.Auth.UserFeatures.TwoFactorAuth.Interfaces;
+using Bit.Core.Dirt.Reports.Models.Data;
+using Bit.Core.Dirt.Reports.ReportFeatures.OrganizationReportMembers.Interfaces;
+using Bit.Core.Dirt.Reports.ReportFeatures.Requests;
using Bit.Core.Entities;
using Bit.Core.Models.Data;
using Bit.Core.Models.Data.Organizations;
using Bit.Core.Models.Data.Organizations.OrganizationUsers;
using Bit.Core.Repositories;
using Bit.Core.Services;
-using Bit.Core.Tools.Models.Data;
-using Bit.Core.Tools.ReportFeatures.OrganizationReportMembers.Interfaces;
-using Bit.Core.Tools.ReportFeatures.Requests;
using Bit.Core.Vault.Models.Data;
using Bit.Core.Vault.Queries;
using Core.AdminConsole.OrganizationFeatures.OrganizationUsers.Interfaces;
using Core.AdminConsole.OrganizationFeatures.OrganizationUsers.Requests;
-namespace Bit.Core.Tools.ReportFeatures;
+namespace Bit.Core.Dirt.Reports.ReportFeatures;
public class MemberAccessCipherDetailsQuery : IMemberAccessCipherDetailsQuery
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/OrganizationReportMembers/Interfaces/IMemberAccessCipherDetailsQuery.cs b/src/Core/Dirt/Reports/ReportFeatures/OrganizationReportMembers/Interfaces/IMemberAccessCipherDetailsQuery.cs
index c55495fd13..98ed780db3 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/OrganizationReportMembers/Interfaces/IMemberAccessCipherDetailsQuery.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/OrganizationReportMembers/Interfaces/IMemberAccessCipherDetailsQuery.cs
@@ -1,7 +1,7 @@
-using Bit.Core.Tools.Models.Data;
-using Bit.Core.Tools.ReportFeatures.Requests;
+using Bit.Core.Dirt.Reports.Models.Data;
+using Bit.Core.Dirt.Reports.ReportFeatures.Requests;
-namespace Bit.Core.Tools.ReportFeatures.OrganizationReportMembers.Interfaces;
+namespace Bit.Core.Dirt.Reports.ReportFeatures.OrganizationReportMembers.Interfaces;
public interface IMemberAccessCipherDetailsQuery
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/ReportingServiceCollectionExtensions.cs b/src/Core/Dirt/Reports/ReportFeatures/ReportingServiceCollectionExtensions.cs
index 4970f0515b..d847c8051e 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/ReportingServiceCollectionExtensions.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/ReportingServiceCollectionExtensions.cs
@@ -1,8 +1,8 @@
-using Bit.Core.Tools.ReportFeatures.Interfaces;
-using Bit.Core.Tools.ReportFeatures.OrganizationReportMembers.Interfaces;
+using Bit.Core.Dirt.Reports.ReportFeatures.Interfaces;
+using Bit.Core.Dirt.Reports.ReportFeatures.OrganizationReportMembers.Interfaces;
using Microsoft.Extensions.DependencyInjection;
-namespace Bit.Core.Tools.ReportFeatures;
+namespace Bit.Core.Dirt.Reports.ReportFeatures;
public static class ReportingServiceCollectionExtensions
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/Requests/AddPasswordHealthReportApplicationRequest.cs b/src/Core/Dirt/Reports/ReportFeatures/Requests/AddPasswordHealthReportApplicationRequest.cs
index dfc544b1c3..c4e646fcd7 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/Requests/AddPasswordHealthReportApplicationRequest.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/Requests/AddPasswordHealthReportApplicationRequest.cs
@@ -1,4 +1,4 @@
-namespace Bit.Core.Tools.ReportFeatures.Requests;
+namespace Bit.Core.Dirt.Reports.ReportFeatures.Requests;
public class AddPasswordHealthReportApplicationRequest
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/Requests/DropPasswordHealthReportApplicationRequest.cs b/src/Core/Dirt/Reports/ReportFeatures/Requests/DropPasswordHealthReportApplicationRequest.cs
index 1464e68f04..544b9a51d5 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/Requests/DropPasswordHealthReportApplicationRequest.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/Requests/DropPasswordHealthReportApplicationRequest.cs
@@ -1,4 +1,4 @@
-namespace Bit.Core.Tools.ReportFeatures.Requests;
+namespace Bit.Core.Dirt.Reports.ReportFeatures.Requests;
public class DropPasswordHealthReportApplicationRequest
{
diff --git a/src/Core/Dirt/Reports/ReportFeatures/Requests/MemberAccessCipherDetailsRequest.cs b/src/Core/Dirt/Reports/ReportFeatures/Requests/MemberAccessCipherDetailsRequest.cs
index 395230f430..b40dfc6dec 100644
--- a/src/Core/Dirt/Reports/ReportFeatures/Requests/MemberAccessCipherDetailsRequest.cs
+++ b/src/Core/Dirt/Reports/ReportFeatures/Requests/MemberAccessCipherDetailsRequest.cs
@@ -1,4 +1,4 @@
-namespace Bit.Core.Tools.ReportFeatures.Requests;
+namespace Bit.Core.Dirt.Reports.ReportFeatures.Requests;
public class MemberAccessCipherDetailsRequest
{
diff --git a/src/Core/Dirt/Reports/Repositories/IPasswordHealthReportApplicationRepository.cs b/src/Core/Dirt/Reports/Repositories/IPasswordHealthReportApplicationRepository.cs
index 374f12e122..5b57932868 100644
--- a/src/Core/Dirt/Reports/Repositories/IPasswordHealthReportApplicationRepository.cs
+++ b/src/Core/Dirt/Reports/Repositories/IPasswordHealthReportApplicationRepository.cs
@@ -1,7 +1,7 @@
-using Bit.Core.Repositories;
-using Bit.Core.Tools.Entities;
+using Bit.Core.Dirt.Reports.Entities;
+using Bit.Core.Repositories;
-namespace Bit.Core.Tools.Repositories;
+namespace Bit.Core.Dirt.Reports.Repositories;
public interface IPasswordHealthReportApplicationRepository : IRepository
{
diff --git a/src/Core/Entities/Collection.cs b/src/Core/Entities/Collection.cs
index 8babe10e4c..275cd80d2f 100644
--- a/src/Core/Entities/Collection.cs
+++ b/src/Core/Entities/Collection.cs
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
+using Bit.Core.Enums;
using Bit.Core.Utilities;
#nullable enable
@@ -14,6 +15,8 @@ public class Collection : ITableObject
public string? ExternalId { get; set; }
public DateTime CreationDate { get; set; } = DateTime.UtcNow;
public DateTime RevisionDate { get; set; } = DateTime.UtcNow;
+ public CollectionType Type { get; set; } = CollectionType.SharedCollection;
+ public string? DefaultUserCollectionEmail { get; set; }
public void SetNewId()
{
diff --git a/src/Core/Enums/CollectionType.cs b/src/Core/Enums/CollectionType.cs
new file mode 100644
index 0000000000..9bc4fcc9c2
--- /dev/null
+++ b/src/Core/Enums/CollectionType.cs
@@ -0,0 +1,7 @@
+namespace Bit.Core.Enums;
+
+public enum CollectionType
+{
+ SharedCollection = 0,
+ DefaultUserCollection = 1,
+}
diff --git a/src/Core/Exceptions/BadRequestException.cs b/src/Core/Exceptions/BadRequestException.cs
index 042f853a57..b27bc7510f 100644
--- a/src/Core/Exceptions/BadRequestException.cs
+++ b/src/Core/Exceptions/BadRequestException.cs
@@ -3,6 +3,8 @@ using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class BadRequestException : Exception
{
public BadRequestException() : base()
@@ -41,5 +43,5 @@ public class BadRequestException : Exception
}
}
- public ModelStateDictionary ModelState { get; set; }
+ public ModelStateDictionary? ModelState { get; set; }
}
diff --git a/src/Core/Exceptions/ConflictException.cs b/src/Core/Exceptions/ConflictException.cs
index 27b90a657f..92fcc52d7f 100644
--- a/src/Core/Exceptions/ConflictException.cs
+++ b/src/Core/Exceptions/ConflictException.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class ConflictException : Exception
{
public ConflictException() : base("Conflict.") { }
diff --git a/src/Core/Exceptions/DnsQueryException.cs b/src/Core/Exceptions/DnsQueryException.cs
index 57b2c56daa..e3f605dec4 100644
--- a/src/Core/Exceptions/DnsQueryException.cs
+++ b/src/Core/Exceptions/DnsQueryException.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class DnsQueryException : Exception
{
public DnsQueryException(string message)
diff --git a/src/Core/Exceptions/DomainClaimedException.cs b/src/Core/Exceptions/DomainClaimedException.cs
index 09ccb3d0d8..9ac6972fa1 100644
--- a/src/Core/Exceptions/DomainClaimedException.cs
+++ b/src/Core/Exceptions/DomainClaimedException.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class DomainClaimedException : Exception
{
public DomainClaimedException()
diff --git a/src/Core/Exceptions/DomainVerifiedException.cs b/src/Core/Exceptions/DomainVerifiedException.cs
index d3a3fd4de4..1fb704bd55 100644
--- a/src/Core/Exceptions/DomainVerifiedException.cs
+++ b/src/Core/Exceptions/DomainVerifiedException.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class DomainVerifiedException : Exception
{
public DomainVerifiedException()
diff --git a/src/Core/Exceptions/DuplicateDomainException.cs b/src/Core/Exceptions/DuplicateDomainException.cs
index 8d347dda55..4f61f333f5 100644
--- a/src/Core/Exceptions/DuplicateDomainException.cs
+++ b/src/Core/Exceptions/DuplicateDomainException.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class DuplicateDomainException : Exception
{
public DuplicateDomainException()
diff --git a/src/Core/Exceptions/FeatureUnavailableException.cs b/src/Core/Exceptions/FeatureUnavailableException.cs
index 7bea350956..80fd7d0635 100644
--- a/src/Core/Exceptions/FeatureUnavailableException.cs
+++ b/src/Core/Exceptions/FeatureUnavailableException.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
///
/// Exception to throw when a requested feature is not yet enabled/available for the requesting context.
///
diff --git a/src/Core/Exceptions/GatewayException.cs b/src/Core/Exceptions/GatewayException.cs
index 73e8cd7613..4b24c8d107 100644
--- a/src/Core/Exceptions/GatewayException.cs
+++ b/src/Core/Exceptions/GatewayException.cs
@@ -1,8 +1,10 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class GatewayException : Exception
{
- public GatewayException(string message, Exception innerException = null)
+ public GatewayException(string message, Exception? innerException = null)
: base(message, innerException)
{ }
}
diff --git a/src/Core/Exceptions/InvalidEmailException.cs b/src/Core/Exceptions/InvalidEmailException.cs
index 1f17acf62e..c38ec0ac38 100644
--- a/src/Core/Exceptions/InvalidEmailException.cs
+++ b/src/Core/Exceptions/InvalidEmailException.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class InvalidEmailException : Exception
{
public InvalidEmailException()
diff --git a/src/Core/Exceptions/InvalidGatewayCustomerIdException.cs b/src/Core/Exceptions/InvalidGatewayCustomerIdException.cs
index cfc7c56c1c..6ec15da308 100644
--- a/src/Core/Exceptions/InvalidGatewayCustomerIdException.cs
+++ b/src/Core/Exceptions/InvalidGatewayCustomerIdException.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class InvalidGatewayCustomerIdException : Exception
{
public InvalidGatewayCustomerIdException()
diff --git a/src/Core/Exceptions/NotFoundException.cs b/src/Core/Exceptions/NotFoundException.cs
index 70769d41ed..6a61e35868 100644
--- a/src/Core/Exceptions/NotFoundException.cs
+++ b/src/Core/Exceptions/NotFoundException.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.Exceptions;
+#nullable enable
+
public class NotFoundException : Exception
{
public NotFoundException() : base()
diff --git a/src/Core/HostedServices/ApplicationCacheHostedService.cs b/src/Core/HostedServices/ApplicationCacheHostedService.cs
index 9021782d20..a699a26fcc 100644
--- a/src/Core/HostedServices/ApplicationCacheHostedService.cs
+++ b/src/Core/HostedServices/ApplicationCacheHostedService.cs
@@ -10,9 +10,11 @@ using Microsoft.Extensions.Logging;
namespace Bit.Core.HostedServices;
+#nullable enable
+
public class ApplicationCacheHostedService : IHostedService, IDisposable
{
- private readonly InMemoryServiceBusApplicationCacheService _applicationCacheService;
+ private readonly InMemoryServiceBusApplicationCacheService? _applicationCacheService;
private readonly IOrganizationRepository _organizationRepository;
protected readonly ILogger _logger;
private readonly ServiceBusClient _serviceBusClient;
@@ -20,8 +22,8 @@ public class ApplicationCacheHostedService : IHostedService, IDisposable
private readonly ServiceBusAdministrationClient _serviceBusAdministrationClient;
private readonly string _subName;
private readonly string _topicName;
- private CancellationTokenSource _cts;
- private Task _executingTask;
+ private CancellationTokenSource? _cts;
+ private Task? _executingTask;
public ApplicationCacheHostedService(
@@ -67,13 +69,17 @@ public class ApplicationCacheHostedService : IHostedService, IDisposable
{
await _subscriptionReceiver.CloseAsync(cancellationToken);
await _serviceBusClient.DisposeAsync();
- _cts.Cancel();
+ _cts?.Cancel();
try
{
await _serviceBusAdministrationClient.DeleteSubscriptionAsync(_topicName, _subName, cancellationToken);
}
catch { }
- await _executingTask;
+
+ if (_executingTask != null)
+ {
+ await _executingTask;
+ }
}
public virtual void Dispose()
diff --git a/src/Core/HostedServices/IpRateLimitSeedStartupService.cs b/src/Core/HostedServices/IpRateLimitSeedStartupService.cs
index a6869d929c..827dd94806 100644
--- a/src/Core/HostedServices/IpRateLimitSeedStartupService.cs
+++ b/src/Core/HostedServices/IpRateLimitSeedStartupService.cs
@@ -3,6 +3,8 @@ using Microsoft.Extensions.Hosting;
namespace Bit.Core.HostedServices;
+#nullable enable
+
///
/// A startup service that will seed the IP rate limiting stores with any values in the
/// GlobalSettings configuration.
diff --git a/src/Core/Jobs/BaseJob.cs b/src/Core/Jobs/BaseJob.cs
index 56c39014a7..a56045f659 100644
--- a/src/Core/Jobs/BaseJob.cs
+++ b/src/Core/Jobs/BaseJob.cs
@@ -3,6 +3,8 @@ using Quartz;
namespace Bit.Core.Jobs;
+#nullable enable
+
public abstract class BaseJob : IJob
{
protected readonly ILogger _logger;
diff --git a/src/Core/Jobs/BaseJobsHostedService.cs b/src/Core/Jobs/BaseJobsHostedService.cs
index 897a382a2b..2ade53c6bb 100644
--- a/src/Core/Jobs/BaseJobsHostedService.cs
+++ b/src/Core/Jobs/BaseJobsHostedService.cs
@@ -8,6 +8,8 @@ using Quartz.Impl.Matchers;
namespace Bit.Core.Jobs;
+#nullable enable
+
public abstract class BaseJobsHostedService : IHostedService, IDisposable
{
private const int MaximumJobRetries = 10;
@@ -16,7 +18,7 @@ public abstract class BaseJobsHostedService : IHostedService, IDisposable
private readonly ILogger _listenerLogger;
protected readonly ILogger _logger;
- private IScheduler _scheduler;
+ private IScheduler? _scheduler;
protected GlobalSettings _globalSettings;
public BaseJobsHostedService(
@@ -31,7 +33,7 @@ public abstract class BaseJobsHostedService : IHostedService, IDisposable
_globalSettings = globalSettings;
}
- public IEnumerable> Jobs { get; protected set; }
+ public IEnumerable>? Jobs { get; protected set; }
public virtual async Task StartAsync(CancellationToken cancellationToken)
{
@@ -61,10 +63,19 @@ public abstract class BaseJobsHostedService : IHostedService, IDisposable
_scheduler.ListenerManager.AddJobListener(new JobListener(_listenerLogger),
GroupMatcher.AnyGroup());
await _scheduler.Start(cancellationToken);
+
+ var jobKeys = new List();
+ var triggerKeys = new List();
+
if (Jobs != null)
{
foreach (var (job, trigger) in Jobs)
{
+ jobKeys.Add(JobBuilder.Create(job)
+ .WithIdentity(job.FullName!)
+ .Build().Key);
+ triggerKeys.Add(trigger.Key);
+
for (var retry = 0; retry < MaximumJobRetries; retry++)
{
// There's a race condition when starting multiple containers simultaneously, retry until it succeeds..
@@ -77,7 +88,7 @@ public abstract class BaseJobsHostedService : IHostedService, IDisposable
}
var jobDetail = JobBuilder.Create(job)
- .WithIdentity(job.FullName)
+ .WithIdentity(job.FullName!)
.Build();
var dupeJ = await _scheduler.GetJobDetail(jobDetail.Key);
@@ -106,13 +117,6 @@ public abstract class BaseJobsHostedService : IHostedService, IDisposable
// Delete old Jobs and Triggers
var existingJobKeys = await _scheduler.GetJobKeys(GroupMatcher.AnyGroup());
- var jobKeys = Jobs.Select(j =>
- {
- var job = j.Item1;
- return JobBuilder.Create(job)
- .WithIdentity(job.FullName)
- .Build().Key;
- });
foreach (var key in existingJobKeys)
{
@@ -126,7 +130,6 @@ public abstract class BaseJobsHostedService : IHostedService, IDisposable
}
var existingTriggerKeys = await _scheduler.GetTriggerKeys(GroupMatcher.AnyGroup());
- var triggerKeys = Jobs.Select(j => j.Item2.Key);
foreach (var key in existingTriggerKeys)
{
@@ -142,7 +145,10 @@ public abstract class BaseJobsHostedService : IHostedService, IDisposable
public virtual async Task StopAsync(CancellationToken cancellationToken)
{
- await _scheduler?.Shutdown(cancellationToken);
+ if (_scheduler is not null)
+ {
+ await _scheduler.Shutdown(cancellationToken);
+ }
}
public virtual void Dispose()
diff --git a/src/Core/Jobs/JobFactory.cs b/src/Core/Jobs/JobFactory.cs
index 6529443d97..8289a90322 100644
--- a/src/Core/Jobs/JobFactory.cs
+++ b/src/Core/Jobs/JobFactory.cs
@@ -4,6 +4,8 @@ using Quartz.Spi;
namespace Bit.Core.Jobs;
+#nullable enable
+
public class JobFactory : IJobFactory
{
private readonly IServiceProvider _container;
@@ -16,7 +18,7 @@ public class JobFactory : IJobFactory
public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
{
var scope = _container.CreateScope();
- return scope.ServiceProvider.GetService(bundle.JobDetail.JobType) as IJob;
+ return (scope.ServiceProvider.GetService(bundle.JobDetail.JobType) as IJob)!;
}
public void ReturnJob(IJob job)
diff --git a/src/Core/Jobs/JobListener.cs b/src/Core/Jobs/JobListener.cs
index e5e05e4b6b..0dc865655d 100644
--- a/src/Core/Jobs/JobListener.cs
+++ b/src/Core/Jobs/JobListener.cs
@@ -3,6 +3,8 @@ using Quartz;
namespace Bit.Core.Jobs;
+#nullable enable
+
public class JobListener : IJobListener
{
private readonly ILogger _logger;
@@ -28,7 +30,7 @@ public class JobListener : IJobListener
return Task.FromResult(0);
}
- public Task JobWasExecuted(IJobExecutionContext context, JobExecutionException jobException,
+ public Task JobWasExecuted(IJobExecutionContext context, JobExecutionException? jobException,
CancellationToken cancellationToken = default(CancellationToken))
{
_logger.LogInformation(Constants.BypassFiltersEventId, null, "Finished job {0} at {1}.",
diff --git a/src/Core/NotificationHub/INotificationHubClientProxy.cs b/src/Core/NotificationHub/INotificationHubClientProxy.cs
index 82b4d39591..78eb0206d6 100644
--- a/src/Core/NotificationHub/INotificationHubClientProxy.cs
+++ b/src/Core/NotificationHub/INotificationHubClientProxy.cs
@@ -2,6 +2,8 @@
namespace Bit.Core.NotificationHub;
+#nullable enable
+
public interface INotificationHubProxy
{
Task<(INotificationHubClient Client, NotificationOutcome Outcome)[]> SendTemplateNotificationAsync(IDictionary properties, string tagExpression);
diff --git a/src/Core/NotificationHub/INotificationHubPool.cs b/src/Core/NotificationHub/INotificationHubPool.cs
index 3981598118..25a31d62f4 100644
--- a/src/Core/NotificationHub/INotificationHubPool.cs
+++ b/src/Core/NotificationHub/INotificationHubPool.cs
@@ -2,6 +2,8 @@
namespace Bit.Core.NotificationHub;
+#nullable enable
+
public interface INotificationHubPool
{
NotificationHubConnection ConnectionFor(Guid comb);
diff --git a/src/Core/NotificationHub/NotificationHubClientProxy.cs b/src/Core/NotificationHub/NotificationHubClientProxy.cs
index 815ac88363..b47069fe21 100644
--- a/src/Core/NotificationHub/NotificationHubClientProxy.cs
+++ b/src/Core/NotificationHub/NotificationHubClientProxy.cs
@@ -2,6 +2,8 @@
namespace Bit.Core.NotificationHub;
+#nullable enable
+
public class NotificationHubClientProxy : INotificationHubProxy
{
private readonly IEnumerable _clients;
diff --git a/src/Core/NotificationHub/NotificationHubConnection.cs b/src/Core/NotificationHub/NotificationHubConnection.cs
index a68134450e..a61f2ded8f 100644
--- a/src/Core/NotificationHub/NotificationHubConnection.cs
+++ b/src/Core/NotificationHub/NotificationHubConnection.cs
@@ -1,4 +1,5 @@
-using System.Security.Cryptography;
+using System.Diagnostics.CodeAnalysis;
+using System.Security.Cryptography;
using System.Text;
using System.Web;
using Bit.Core.Settings;
@@ -7,21 +8,23 @@ using Microsoft.Azure.NotificationHubs;
namespace Bit.Core.NotificationHub;
+#nullable enable
+
public class NotificationHubConnection
{
- public string HubName { get; init; }
- public string ConnectionString { get; init; }
+ public string? HubName { get; init; }
+ public string? ConnectionString { get; init; }
private Lazy _parsedConnectionString;
public Uri Endpoint => _parsedConnectionString.Value.Endpoint;
private string SasKey => _parsedConnectionString.Value.SharedAccessKey;
private string SasKeyName => _parsedConnectionString.Value.SharedAccessKeyName;
public bool EnableSendTracing { get; init; }
- private NotificationHubClient _hubClient;
+ private NotificationHubClient? _hubClient;
///
/// Gets the NotificationHubClient for this connection.
- ///
+ ///
/// If the client is null, it will be initialized.
- ///
+ ///
/// Exception if the connection is invalid.
///
public NotificationHubClient HubClient
@@ -45,13 +48,13 @@ public class NotificationHubConnection
}
///
/// Gets the start date for registration.
- ///
+ ///
/// If null, registration is always disabled.
///
public DateTime? RegistrationStartDate { get; init; }
///
/// Gets the end date for registration.
- ///
+ ///
/// If null, registration has no end date.
///
public DateTime? RegistrationEndDate { get; init; }
@@ -155,9 +158,10 @@ public class NotificationHubConnection
};
}
+ [MemberNotNull(nameof(_hubClient))]
private NotificationHubConnection Init()
{
- HubClient = NotificationHubClient.CreateClientFromConnectionString(ConnectionString, HubName, EnableSendTracing);
+ _hubClient = NotificationHubClient.CreateClientFromConnectionString(ConnectionString, HubName, EnableSendTracing);
return this;
}
diff --git a/src/Core/NotificationHub/NotificationHubPool.cs b/src/Core/NotificationHub/NotificationHubPool.cs
index 6b48e82f88..38192c11fc 100644
--- a/src/Core/NotificationHub/NotificationHubPool.cs
+++ b/src/Core/NotificationHub/NotificationHubPool.cs
@@ -5,6 +5,8 @@ using Microsoft.Extensions.Logging;
namespace Bit.Core.NotificationHub;
+#nullable enable
+
public class NotificationHubPool : INotificationHubPool
{
private List _connections { get; }
diff --git a/src/Core/NotificationHub/NotificationHubPushNotificationService.cs b/src/Core/NotificationHub/NotificationHubPushNotificationService.cs
index bb3de80977..368c0f731b 100644
--- a/src/Core/NotificationHub/NotificationHubPushNotificationService.cs
+++ b/src/Core/NotificationHub/NotificationHubPushNotificationService.cs
@@ -19,6 +19,8 @@ using Notification = Bit.Core.NotificationCenter.Entities.Notification;
namespace Bit.Core.NotificationHub;
+#nullable enable
+
///
/// Sends mobile push notifications to the Azure Notification Hub.
/// Used by Cloud-Hosted environments.
diff --git a/src/Core/NotificationHub/NotificationHubPushRegistrationService.cs b/src/Core/NotificationHub/NotificationHubPushRegistrationService.cs
index f44fcf91a0..dc494eecd6 100644
--- a/src/Core/NotificationHub/NotificationHubPushRegistrationService.cs
+++ b/src/Core/NotificationHub/NotificationHubPushRegistrationService.cs
@@ -13,6 +13,8 @@ using Microsoft.Extensions.Logging;
namespace Bit.Core.NotificationHub;
+#nullable enable
+
public class NotificationHubPushRegistrationService : IPushRegistrationService
{
private static readonly JsonSerializerOptions webPushSerializationOptions = new()
@@ -37,7 +39,7 @@ public class NotificationHubPushRegistrationService : IPushRegistrationService
}
public async Task CreateOrUpdateRegistrationAsync(PushRegistrationData data, string deviceId, string userId,
- string identifier, DeviceType type, IEnumerable organizationIds, Guid installationId)
+ string? identifier, DeviceType type, IEnumerable organizationIds, Guid installationId)
{
var orgIds = organizationIds.ToList();
var clientType = DeviceTypes.ToClientType(type);
@@ -79,7 +81,7 @@ public class NotificationHubPushRegistrationService : IPushRegistrationService
}
private async Task CreateOrUpdateMobileRegistrationAsync(Installation installation, string userId,
- string identifier, ClientType clientType, List organizationIds, DeviceType type, Guid installationId)
+ string? identifier, ClientType clientType, List organizationIds, DeviceType type, Guid installationId)
{
if (string.IsNullOrWhiteSpace(installation.PushChannel))
{
@@ -137,7 +139,7 @@ public class NotificationHubPushRegistrationService : IPushRegistrationService
}
private async Task CreateOrUpdateWebRegistrationAsync(string endpoint, string p256dh, string auth, Installation installation, string userId,
- string identifier, ClientType clientType, List organizationIds, Guid installationId)
+ string? identifier, ClientType clientType, List organizationIds, Guid installationId)
{
// The Azure SDK is currently lacking support for web push registrations.
// We need to use the REST API directly.
@@ -187,7 +189,7 @@ public class NotificationHubPushRegistrationService : IPushRegistrationService
}
private static KeyValuePair BuildInstallationTemplate(string templateId, [StringSyntax(StringSyntaxAttribute.Json)] string templateBody,
- string userId, string identifier, ClientType clientType, List organizationIds, Guid installationId)
+ string userId, string? identifier, ClientType clientType, List organizationIds, Guid installationId)
{
var fullTemplateId = $"template:{templateId}";
diff --git a/src/Core/NotificationHub/PushRegistrationData.cs b/src/Core/NotificationHub/PushRegistrationData.cs
index 20e1cf0936..c11ee7be23 100644
--- a/src/Core/NotificationHub/PushRegistrationData.cs
+++ b/src/Core/NotificationHub/PushRegistrationData.cs
@@ -1,5 +1,7 @@
namespace Bit.Core.NotificationHub;
+#nullable enable
+
public record struct WebPushRegistrationData
{
public string Endpoint { get; init; }
@@ -9,9 +11,9 @@ public record struct WebPushRegistrationData
public record class PushRegistrationData
{
- public string Token { get; set; }
+ public string? Token { get; set; }
public WebPushRegistrationData? WebPush { get; set; }
- public PushRegistrationData(string token)
+ public PushRegistrationData(string? token)
{
Token = token;
}
diff --git a/src/Core/Services/Implementations/StripePaymentService.cs b/src/Core/Services/Implementations/StripePaymentService.cs
index 23d06bed2b..bdd558df52 100644
--- a/src/Core/Services/Implementations/StripePaymentService.cs
+++ b/src/Core/Services/Implementations/StripePaymentService.cs
@@ -842,7 +842,13 @@ public class StripePaymentService : IPaymentService
try
{
await _stripeAdapter.TaxIdCreateAsync(customer.Id,
- new TaxIdCreateOptions { Type = taxInfo.TaxIdType, Value = taxInfo.TaxIdNumber, });
+ new TaxIdCreateOptions { Type = taxInfo.TaxIdType, Value = taxInfo.TaxIdNumber });
+
+ if (taxInfo.TaxIdType == StripeConstants.TaxIdType.SpanishNIF)
+ {
+ await _stripeAdapter.TaxIdCreateAsync(customer.Id,
+ new TaxIdCreateOptions { Type = StripeConstants.TaxIdType.EUVAT, Value = $"ES{taxInfo.TaxIdNumber}" });
+ }
}
catch (StripeException e)
{
@@ -1000,6 +1006,15 @@ public class StripePaymentService : IPaymentService
Value = parameters.TaxInformation.TaxId
}
];
+
+ if (taxIdType == StripeConstants.TaxIdType.SpanishNIF)
+ {
+ options.CustomerDetails.TaxIds.Add(new InvoiceCustomerDetailsTaxIdOptions
+ {
+ Type = StripeConstants.TaxIdType.EUVAT,
+ Value = $"ES{parameters.TaxInformation.TaxId}"
+ });
+ }
}
if (!string.IsNullOrWhiteSpace(gatewayCustomerId))
@@ -1154,6 +1169,15 @@ public class StripePaymentService : IPaymentService
Value = parameters.TaxInformation.TaxId
}
];
+
+ if (taxIdType == StripeConstants.TaxIdType.SpanishNIF)
+ {
+ options.CustomerDetails.TaxIds.Add(new InvoiceCustomerDetailsTaxIdOptions
+ {
+ Type = StripeConstants.TaxIdType.EUVAT,
+ Value = $"ES{parameters.TaxInformation.TaxId}"
+ });
+ }
}
Customer gatewayCustomer = null;
diff --git a/src/Core/Vault/Services/Implementations/CipherService.cs b/src/Core/Vault/Services/Implementations/CipherService.cs
index 413aee3e0d..5d17441024 100644
--- a/src/Core/Vault/Services/Implementations/CipherService.cs
+++ b/src/Core/Vault/Services/Implementations/CipherService.cs
@@ -821,11 +821,6 @@ public class CipherService : ICipherService
private async Task UserCanDeleteAsync(CipherDetails cipher, Guid userId)
{
- if (!_featureService.IsEnabled(FeatureFlagKeys.LimitItemDeletion))
- {
- return await UserCanEditAsync(cipher, userId);
- }
-
var user = await _userService.GetUserByIdAsync(userId);
var organizationAbility = cipher.OrganizationId.HasValue ?
await _applicationCacheService.GetOrganizationAbilityAsync(cipher.OrganizationId.Value) : null;
@@ -835,11 +830,6 @@ public class CipherService : ICipherService
private async Task UserCanRestoreAsync(CipherDetails cipher, Guid userId)
{
- if (!_featureService.IsEnabled(FeatureFlagKeys.LimitItemDeletion))
- {
- return await UserCanEditAsync(cipher, userId);
- }
-
var user = await _userService.GetUserByIdAsync(userId);
var organizationAbility = cipher.OrganizationId.HasValue ?
await _applicationCacheService.GetOrganizationAbilityAsync(cipher.OrganizationId.Value) : null;
@@ -1059,17 +1049,11 @@ public class CipherService : ICipherService
}
// This method is used to filter ciphers based on the user's permissions to delete them.
- // It supports both the old and new logic depending on the feature flag.
private async Task> FilterCiphersByDeletePermission(
IEnumerable ciphers,
HashSet cipherIdsSet,
Guid userId) where T : CipherDetails
{
- if (!_featureService.IsEnabled(FeatureFlagKeys.LimitItemDeletion))
- {
- return ciphers.Where(c => cipherIdsSet.Contains(c.Id) && c.Edit).ToList();
- }
-
var user = await _userService.GetUserByIdAsync(userId);
var organizationAbilities = await _applicationCacheService.GetOrganizationAbilitiesAsync();
diff --git a/src/Icons/Controllers/IconsController.cs b/src/Icons/Controllers/IconsController.cs
index 871219b366..b0d9306f94 100644
--- a/src/Icons/Controllers/IconsController.cs
+++ b/src/Icons/Controllers/IconsController.cs
@@ -8,16 +8,6 @@ namespace Bit.Icons.Controllers;
[Route("")]
public class IconsController : Controller
{
- // Basic bwi-globe icon
- private static readonly byte[] _notFoundImage = Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUg" +
- "AAABMAAAATCAQAAADYWf5HAAABu0lEQVR42nXSvWuTURTH8R+t0heI9Y04aJycdBLNJNrBFBU7OFgUER3q21I0bXK+JwZ" +
- "pXISm/QdcRB3EgqBBsNihsUbbgODQQSKCuKSDOApJuuhj8tCYQj/jvYfD795z1MZ+nBKrNKhSwrMxbZTrtRnqlEjZkB/x" +
- "C/xmhZrlc71qS0Up8yVzTCGucFNKD1JhORVd70SZNU4okNx5d4+U2UXRIpJFWLClsR79YzN88wQvLWNzzPKEeS/wkQGpW" +
- "VhhqhW8TtDJD3Mm1x/23zLSrZCdpBY8BueTNjHSbc+8wC9HlHgU5Aj5AW5zPdcVdpq0UcknWBSr/pjixO4gfp899Kd23p" +
- "M2qQCH7LkCnqAqGh73OK/8NPOcaibr90LrW/yWAnaUhqjaOSl9nFR2r5rsqo22ypn1B5IN8VOUMHVgOnNQIX+d62plcz6" +
- "rg1/jskK8CMb4we4pG6OWHtR/LBJkC2E4a7ZPkuX5ntumAOM2xxveclEhLvGH6XCmLPs735Eetrw63NnOgr9P9q1viC3x" +
- "lRUGOjImqFDuOBvrYYoaZU9z1uPpYae5NfdvbNVG2ZjDIlXq/oMi46lo++4vjjPBl2Dlg00AAAAASUVORK5CYII=");
-
private readonly IMemoryCache _memoryCache;
private readonly IDomainMappingService _domainMappingService;
private readonly IIconFetchingService _iconFetchingService;
@@ -99,7 +89,7 @@ public class IconsController : Controller
if (icon == null)
{
- return new FileContentResult(_notFoundImage, "image/png");
+ return new NotFoundResult();
}
return new FileContentResult(icon.Image, icon.Format);
diff --git a/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs
index ba374ae988..a95c2bd4c6 100644
--- a/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs
+++ b/src/Infrastructure.Dapper/DapperServiceCollectionExtensions.cs
@@ -2,6 +2,7 @@
using Bit.Core.Auth.Repositories;
using Bit.Core.Billing.Providers.Repositories;
using Bit.Core.Billing.Repositories;
+using Bit.Core.Dirt.Reports.Repositories;
using Bit.Core.KeyManagement.Repositories;
using Bit.Core.NotificationCenter.Repositories;
using Bit.Core.Platform.Installations;
@@ -12,6 +13,7 @@ using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.Dapper.AdminConsole.Repositories;
using Bit.Infrastructure.Dapper.Auth.Repositories;
using Bit.Infrastructure.Dapper.Billing.Repositories;
+using Bit.Infrastructure.Dapper.Dirt;
using Bit.Infrastructure.Dapper.KeyManagement.Repositories;
using Bit.Infrastructure.Dapper.NotificationCenter.Repositories;
using Bit.Infrastructure.Dapper.Platform;
diff --git a/src/Infrastructure.Dapper/Dirt/PasswordHealthReportApplicationRepository.cs b/src/Infrastructure.Dapper/Dirt/PasswordHealthReportApplicationRepository.cs
index 0c45998416..2445de8a9e 100644
--- a/src/Infrastructure.Dapper/Dirt/PasswordHealthReportApplicationRepository.cs
+++ b/src/Infrastructure.Dapper/Dirt/PasswordHealthReportApplicationRepository.cs
@@ -1,14 +1,14 @@
using System.Data;
+using Bit.Core.Dirt.Reports.Entities;
+using Bit.Core.Dirt.Reports.Repositories;
using Bit.Core.Settings;
-using Bit.Core.Tools.Repositories;
using Bit.Infrastructure.Dapper.Repositories;
using Dapper;
using Microsoft.Data.SqlClient;
-using ToolsEntities = Bit.Core.Tools.Entities;
-namespace Bit.Infrastructure.Dapper.Tools.Repositories;
+namespace Bit.Infrastructure.Dapper.Dirt;
-public class PasswordHealthReportApplicationRepository : Repository, IPasswordHealthReportApplicationRepository
+public class PasswordHealthReportApplicationRepository : Repository, IPasswordHealthReportApplicationRepository
{
public PasswordHealthReportApplicationRepository(GlobalSettings globalSettings)
: this(globalSettings.SqlServer.ConnectionString, globalSettings.SqlServer.ReadOnlyConnectionString)
@@ -18,11 +18,11 @@ public class PasswordHealthReportApplicationRepository : Repository> GetByOrganizationIdAsync(Guid organizationId)
+ public async Task> GetByOrganizationIdAsync(Guid organizationId)
{
using (var connection = new SqlConnection(ReadOnlyConnectionString))
{
- var results = await connection.QueryAsync(
+ var results = await connection.QueryAsync(
$"[{Schema}].[PasswordHealthReportApplication_ReadByOrganizationId]",
new { OrganizationId = organizationId },
commandType: CommandType.StoredProcedure);
diff --git a/src/Infrastructure.EntityFramework/Tools/Configurations/PasswordHealthReportApplicationEntityTypeConfiguration.cs b/src/Infrastructure.EntityFramework/Dirt/Configurations/PasswordHealthReportApplicationEntityTypeConfiguration.cs
similarity index 83%
rename from src/Infrastructure.EntityFramework/Tools/Configurations/PasswordHealthReportApplicationEntityTypeConfiguration.cs
rename to src/Infrastructure.EntityFramework/Dirt/Configurations/PasswordHealthReportApplicationEntityTypeConfiguration.cs
index 4f4c5473d5..0d3c8ffc61 100644
--- a/src/Infrastructure.EntityFramework/Tools/Configurations/PasswordHealthReportApplicationEntityTypeConfiguration.cs
+++ b/src/Infrastructure.EntityFramework/Dirt/Configurations/PasswordHealthReportApplicationEntityTypeConfiguration.cs
@@ -1,8 +1,8 @@
-using Bit.Infrastructure.EntityFramework.Tools.Models;
+using Bit.Infrastructure.EntityFramework.Dirt.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
-namespace Bit.Infrastructure.EntityFramework.Tools.Configurations;
+namespace Bit.Infrastructure.EntityFramework.Dirt.Configurations;
public class PasswordHealthReportApplicationEntityTypeConfiguration : IEntityTypeConfiguration
{
diff --git a/src/Infrastructure.EntityFramework/Tools/Models/PasswordHealthReportApplication.cs b/src/Infrastructure.EntityFramework/Dirt/Models/PasswordHealthReportApplication.cs
similarity index 52%
rename from src/Infrastructure.EntityFramework/Tools/Models/PasswordHealthReportApplication.cs
rename to src/Infrastructure.EntityFramework/Dirt/Models/PasswordHealthReportApplication.cs
index 524cd283c6..222bfbeb65 100644
--- a/src/Infrastructure.EntityFramework/Tools/Models/PasswordHealthReportApplication.cs
+++ b/src/Infrastructure.EntityFramework/Dirt/Models/PasswordHealthReportApplication.cs
@@ -1,9 +1,9 @@
using AutoMapper;
using Bit.Infrastructure.EntityFramework.AdminConsole.Models;
-namespace Bit.Infrastructure.EntityFramework.Tools.Models;
+namespace Bit.Infrastructure.EntityFramework.Dirt.Models;
-public class PasswordHealthReportApplication : Core.Tools.Entities.PasswordHealthReportApplication
+public class PasswordHealthReportApplication : Core.Dirt.Reports.Entities.PasswordHealthReportApplication
{
public virtual Organization Organization { get; set; }
}
@@ -12,7 +12,7 @@ public class PasswordHealthReportApplicationProfile : Profile
{
public PasswordHealthReportApplicationProfile()
{
- CreateMap()
+ CreateMap()
.ReverseMap();
}
}
diff --git a/src/Infrastructure.EntityFramework/Tools/Repositories/PasswordHealthReportApplicationRepository.cs b/src/Infrastructure.EntityFramework/Dirt/Repositories/PasswordHealthReportApplicationRepository.cs
similarity index 58%
rename from src/Infrastructure.EntityFramework/Tools/Repositories/PasswordHealthReportApplicationRepository.cs
rename to src/Infrastructure.EntityFramework/Dirt/Repositories/PasswordHealthReportApplicationRepository.cs
index 1d8204a82f..604a0d87a1 100644
--- a/src/Infrastructure.EntityFramework/Tools/Repositories/PasswordHealthReportApplicationRepository.cs
+++ b/src/Infrastructure.EntityFramework/Dirt/Repositories/PasswordHealthReportApplicationRepository.cs
@@ -1,22 +1,21 @@
using AutoMapper;
-using Bit.Core.Tools.Repositories;
+using Bit.Core.Dirt.Reports.Repositories;
+using Bit.Infrastructure.EntityFramework.Dirt.Models;
using Bit.Infrastructure.EntityFramework.Repositories;
-using Bit.Infrastructure.EntityFramework.Tools.Models;
using LinqToDB;
using Microsoft.Extensions.DependencyInjection;
-using AdminConsoleEntities = Bit.Core.Tools.Entities;
-namespace Bit.Infrastructure.EntityFramework.Tools.Repositories;
+namespace Bit.Infrastructure.EntityFramework.Dirt.Repositories;
public class PasswordHealthReportApplicationRepository :
- Repository,
+ Repository,
IPasswordHealthReportApplicationRepository
{
public PasswordHealthReportApplicationRepository(IServiceScopeFactory serviceScopeFactory,
IMapper mapper) : base(serviceScopeFactory, mapper, (DatabaseContext context) => context.PasswordHealthReportApplications)
{ }
- public async Task> GetByOrganizationIdAsync(Guid organizationId)
+ public async Task> GetByOrganizationIdAsync(Guid organizationId)
{
using (var scope = ServiceScopeFactory.CreateScope())
{
@@ -24,7 +23,7 @@ public class PasswordHealthReportApplicationRepository :
var results = await dbContext.PasswordHealthReportApplications
.Where(p => p.OrganizationId == organizationId)
.ToListAsync();
- return Mapper.Map>(results);
+ return Mapper.Map>(results);
}
}
}
diff --git a/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs
index 22818517d3..321c4c90e5 100644
--- a/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs
+++ b/src/Infrastructure.EntityFramework/EntityFrameworkServiceCollectionExtensions.cs
@@ -2,6 +2,7 @@
using Bit.Core.Auth.Repositories;
using Bit.Core.Billing.Providers.Repositories;
using Bit.Core.Billing.Repositories;
+using Bit.Core.Dirt.Reports.Repositories;
using Bit.Core.Enums;
using Bit.Core.KeyManagement.Repositories;
using Bit.Core.NotificationCenter.Repositories;
@@ -13,6 +14,7 @@ using Bit.Core.Vault.Repositories;
using Bit.Infrastructure.EntityFramework.AdminConsole.Repositories;
using Bit.Infrastructure.EntityFramework.Auth.Repositories;
using Bit.Infrastructure.EntityFramework.Billing.Repositories;
+using Bit.Infrastructure.EntityFramework.Dirt.Repositories;
using Bit.Infrastructure.EntityFramework.KeyManagement.Repositories;
using Bit.Infrastructure.EntityFramework.NotificationCenter.Repositories;
using Bit.Infrastructure.EntityFramework.Platform;
diff --git a/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs b/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs
index 5c1c1bc87f..647b3e3ab1 100644
--- a/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs
+++ b/src/Infrastructure.EntityFramework/Repositories/DatabaseContext.cs
@@ -4,11 +4,11 @@ using Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider;
using Bit.Infrastructure.EntityFramework.Auth.Models;
using Bit.Infrastructure.EntityFramework.Billing.Models;
using Bit.Infrastructure.EntityFramework.Converters;
+using Bit.Infrastructure.EntityFramework.Dirt.Models;
using Bit.Infrastructure.EntityFramework.Models;
using Bit.Infrastructure.EntityFramework.NotificationCenter.Models;
using Bit.Infrastructure.EntityFramework.Platform;
using Bit.Infrastructure.EntityFramework.SecretsManager.Models;
-using Bit.Infrastructure.EntityFramework.Tools.Models;
using Bit.Infrastructure.EntityFramework.Vault.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
diff --git a/src/SharedWeb/SharedWeb.csproj b/src/SharedWeb/SharedWeb.csproj
index 6df65b2310..1951e4d509 100644
--- a/src/SharedWeb/SharedWeb.csproj
+++ b/src/SharedWeb/SharedWeb.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs b/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs
index ccf2b5212f..5451400803 100644
--- a/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs
+++ b/src/SharedWeb/Utilities/ServiceCollectionExtensions.cs
@@ -23,6 +23,7 @@ using Bit.Core.Auth.UserFeatures;
using Bit.Core.Billing.Services;
using Bit.Core.Billing.Services.Implementations;
using Bit.Core.Billing.TrialInitiation;
+using Bit.Core.Dirt.Reports.ReportFeatures;
using Bit.Core.Entities;
using Bit.Core.Enums;
using Bit.Core.HostedServices;
@@ -43,7 +44,6 @@ using Bit.Core.Services;
using Bit.Core.Settings;
using Bit.Core.Tokens;
using Bit.Core.Tools.ImportFeatures;
-using Bit.Core.Tools.ReportFeatures;
using Bit.Core.Tools.SendFeatures;
using Bit.Core.Tools.Services;
using Bit.Core.Utilities;
diff --git a/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_Create.sql b/src/Sql/dbo/Auth/Stored Procedures/AuthRequest_Create.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/AuthRequest_Create.sql
rename to src/Sql/dbo/Auth/Stored Procedures/AuthRequest_Create.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_DeleteById.sql b/src/Sql/dbo/Auth/Stored Procedures/AuthRequest_DeleteById.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/AuthRequest_DeleteById.sql
rename to src/Sql/dbo/Auth/Stored Procedures/AuthRequest_DeleteById.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_DeleteIfExpired.sql b/src/Sql/dbo/Auth/Stored Procedures/AuthRequest_DeleteIfExpired.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/AuthRequest_DeleteIfExpired.sql
rename to src/Sql/dbo/Auth/Stored Procedures/AuthRequest_DeleteIfExpired.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadAdminApprovalsByIds.sql b/src/Sql/dbo/Auth/Stored Procedures/AuthRequest_ReadAdminApprovalsByIds.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadAdminApprovalsByIds.sql
rename to src/Sql/dbo/Auth/Stored Procedures/AuthRequest_ReadAdminApprovalsByIds.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadById.sql b/src/Sql/dbo/Auth/Stored Procedures/AuthRequest_ReadById.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadById.sql
rename to src/Sql/dbo/Auth/Stored Procedures/AuthRequest_ReadById.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadByUserId.sql b/src/Sql/dbo/Auth/Stored Procedures/AuthRequest_ReadByUserId.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadByUserId.sql
rename to src/Sql/dbo/Auth/Stored Procedures/AuthRequest_ReadByUserId.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadPendingByOrganizationId.sql b/src/Sql/dbo/Auth/Stored Procedures/AuthRequest_ReadPendingByOrganizationId.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/AuthRequest_ReadPendingByOrganizationId.sql
rename to src/Sql/dbo/Auth/Stored Procedures/AuthRequest_ReadPendingByOrganizationId.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_Update.sql b/src/Sql/dbo/Auth/Stored Procedures/AuthRequest_Update.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/AuthRequest_Update.sql
rename to src/Sql/dbo/Auth/Stored Procedures/AuthRequest_Update.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/AuthRequest_UpdateMany.sql b/src/Sql/dbo/Auth/Stored Procedures/AuthRequest_UpdateMany.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/AuthRequest_UpdateMany.sql
rename to src/Sql/dbo/Auth/Stored Procedures/AuthRequest_UpdateMany.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/Device_ReadActiveWithPendingAuthRequestsByUserId.sql b/src/Sql/dbo/Auth/Stored Procedures/Device_ReadActiveWithPendingAuthRequestsByUserId.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/Device_ReadActiveWithPendingAuthRequestsByUserId.sql
rename to src/Sql/dbo/Auth/Stored Procedures/Device_ReadActiveWithPendingAuthRequestsByUserId.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGranteeId.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccessDetails_ReadByGranteeId.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGranteeId.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccessDetails_ReadByGranteeId.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGrantorId.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccessDetails_ReadByGrantorId.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByGrantorId.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccessDetails_ReadByGrantorId.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByIdGrantorId.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccessDetails_ReadByIdGrantorId.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadByIdGrantorId.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccessDetails_ReadByIdGrantorId.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadExpiredRecoveries.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccessDetails_ReadExpiredRecoveries.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccessDetails_ReadExpiredRecoveries.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccessDetails_ReadExpiredRecoveries.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_Create.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_Create.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_Create.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_Create.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_DeleteById.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_DeleteById.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_DeleteById.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_DeleteById.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadById.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_ReadById.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadById.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_ReadById.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadCountByGrantorIdEmail.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_ReadCountByGrantorIdEmail.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadCountByGrantorIdEmail.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_ReadCountByGrantorIdEmail.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadToNotify.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_ReadToNotify.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_ReadToNotify.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_ReadToNotify.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_Update.sql b/src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_Update.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/EmergencyAccess_Update.sql
rename to src/Sql/dbo/Auth/Stored Procedures/EmergencyAccess_Update.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/Grant_Delete.sql b/src/Sql/dbo/Auth/Stored Procedures/Grant_Delete.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/Grant_Delete.sql
rename to src/Sql/dbo/Auth/Stored Procedures/Grant_Delete.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/Grant_DeleteByKey.sql b/src/Sql/dbo/Auth/Stored Procedures/Grant_DeleteByKey.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/Grant_DeleteByKey.sql
rename to src/Sql/dbo/Auth/Stored Procedures/Grant_DeleteByKey.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/Grant_DeleteExpired.sql b/src/Sql/dbo/Auth/Stored Procedures/Grant_DeleteExpired.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/Grant_DeleteExpired.sql
rename to src/Sql/dbo/Auth/Stored Procedures/Grant_DeleteExpired.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/Grant_Read.sql b/src/Sql/dbo/Auth/Stored Procedures/Grant_Read.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/Grant_Read.sql
rename to src/Sql/dbo/Auth/Stored Procedures/Grant_Read.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/Grant_ReadByKey.sql b/src/Sql/dbo/Auth/Stored Procedures/Grant_ReadByKey.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/Grant_ReadByKey.sql
rename to src/Sql/dbo/Auth/Stored Procedures/Grant_ReadByKey.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/Grant_Save.sql b/src/Sql/dbo/Auth/Stored Procedures/Grant_Save.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/Grant_Save.sql
rename to src/Sql/dbo/Auth/Stored Procedures/Grant_Save.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_Create.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoConfig_Create.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoConfig_Create.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoConfig_Create.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_DeleteById.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoConfig_DeleteById.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoConfig_DeleteById.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoConfig_DeleteById.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadById.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoConfig_ReadById.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadById.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoConfig_ReadById.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadByIdentifier.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoConfig_ReadByIdentifier.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadByIdentifier.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoConfig_ReadByIdentifier.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadByOrganizationId.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoConfig_ReadByOrganizationId.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadByOrganizationId.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoConfig_ReadByOrganizationId.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadManyByNotBeforeRevisionDate.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoConfig_ReadManyByNotBeforeRevisionDate.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoConfig_ReadManyByNotBeforeRevisionDate.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoConfig_ReadManyByNotBeforeRevisionDate.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoConfig_Update.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoConfig_Update.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoConfig_Update.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoConfig_Update.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoUser_Create.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoUser_Create.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoUser_Create.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoUser_Create.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoUser_Delete.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoUser_Delete.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoUser_Delete.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoUser_Delete.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoUser_DeleteById.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoUser_DeleteById.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoUser_DeleteById.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoUser_DeleteById.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoUser_DeleteMany.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoUser_DeleteMany.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoUser_DeleteMany.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoUser_DeleteMany.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoUser_ReadById.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoUser_ReadById.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoUser_ReadById.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoUser_ReadById.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoUser_ReadByUserIdOrganizationId.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoUser_ReadByUserIdOrganizationId.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoUser_ReadByUserIdOrganizationId.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoUser_ReadByUserIdOrganizationId.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/SsoUser_Update.sql b/src/Sql/dbo/Auth/Stored Procedures/SsoUser_Update.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/SsoUser_Update.sql
rename to src/Sql/dbo/Auth/Stored Procedures/SsoUser_Update.sql
diff --git a/src/Sql/Auth/dbo/Stored Procedures/User_BumpAccountRevisionDateByEmergencyAccessGranteeId.sql b/src/Sql/dbo/Auth/Stored Procedures/User_BumpAccountRevisionDateByEmergencyAccessGranteeId.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Stored Procedures/User_BumpAccountRevisionDateByEmergencyAccessGranteeId.sql
rename to src/Sql/dbo/Auth/Stored Procedures/User_BumpAccountRevisionDateByEmergencyAccessGranteeId.sql
diff --git a/src/Sql/Auth/dbo/Tables/AuthRequest.sql b/src/Sql/dbo/Auth/Tables/AuthRequest.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Tables/AuthRequest.sql
rename to src/Sql/dbo/Auth/Tables/AuthRequest.sql
diff --git a/src/Sql/Auth/dbo/Tables/EmergencyAccess.sql b/src/Sql/dbo/Auth/Tables/EmergencyAccess.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Tables/EmergencyAccess.sql
rename to src/Sql/dbo/Auth/Tables/EmergencyAccess.sql
diff --git a/src/Sql/Auth/dbo/Tables/Grant.sql b/src/Sql/dbo/Auth/Tables/Grant.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Tables/Grant.sql
rename to src/Sql/dbo/Auth/Tables/Grant.sql
diff --git a/src/Sql/Auth/dbo/Tables/SsoConfig.sql b/src/Sql/dbo/Auth/Tables/SsoConfig.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Tables/SsoConfig.sql
rename to src/Sql/dbo/Auth/Tables/SsoConfig.sql
diff --git a/src/Sql/Auth/dbo/Tables/SsoUser.sql b/src/Sql/dbo/Auth/Tables/SsoUser.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Tables/SsoUser.sql
rename to src/Sql/dbo/Auth/Tables/SsoUser.sql
diff --git a/src/Sql/Auth/dbo/Views/AuthRequestView.sql b/src/Sql/dbo/Auth/Views/AuthRequestView.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Views/AuthRequestView.sql
rename to src/Sql/dbo/Auth/Views/AuthRequestView.sql
diff --git a/src/Sql/Auth/dbo/Views/EmergencyAccessDetailsView.sql b/src/Sql/dbo/Auth/Views/EmergencyAccessDetailsView.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Views/EmergencyAccessDetailsView.sql
rename to src/Sql/dbo/Auth/Views/EmergencyAccessDetailsView.sql
diff --git a/src/Sql/Auth/dbo/Views/GrantView.sql b/src/Sql/dbo/Auth/Views/GrantView.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Views/GrantView.sql
rename to src/Sql/dbo/Auth/Views/GrantView.sql
diff --git a/src/Sql/Auth/dbo/Views/SsoConfigView.sql b/src/Sql/dbo/Auth/Views/SsoConfigView.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Views/SsoConfigView.sql
rename to src/Sql/dbo/Auth/Views/SsoConfigView.sql
diff --git a/src/Sql/Auth/dbo/Views/SsoUserView.sql b/src/Sql/dbo/Auth/Views/SsoUserView.sql
similarity index 100%
rename from src/Sql/Auth/dbo/Views/SsoUserView.sql
rename to src/Sql/dbo/Auth/Views/SsoUserView.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_Create.sql b/src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_Create.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_Create.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_Create.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_DeleteById.sql b/src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_DeleteById.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_DeleteById.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_DeleteById.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_ReadById.sql b/src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_ReadById.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_ReadById.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_ReadById.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_ReadByOrganizationId.sql b/src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_ReadByOrganizationId.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_ReadByOrganizationId.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_ReadByOrganizationId.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_ReadByProviderId.sql b/src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_ReadByProviderId.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_ReadByProviderId.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_ReadByProviderId.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_Update.sql b/src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_Update.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ClientOrganizationMigrationRecord_Update.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ClientOrganizationMigrationRecord_Update.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_Create.sql b/src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_Create.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_Create.sql
rename to src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_Create.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_DeleteById.sql b/src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_DeleteById.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_DeleteById.sql
rename to src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_DeleteById.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_ReadById.sql b/src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_ReadById.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_ReadById.sql
rename to src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_ReadById.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_ReadByInstallationId.sql b/src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_ReadByInstallationId.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_ReadByInstallationId.sql
rename to src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_ReadByInstallationId.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_ReadByOrganizationId.sql b/src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_ReadByOrganizationId.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_ReadByOrganizationId.sql
rename to src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_ReadByOrganizationId.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_Update.sql b/src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_Update.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/OrganizationInstallation_Update.sql
rename to src/Sql/dbo/Billing/Stored Procedures/OrganizationInstallation_Update.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_Create.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_Create.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_Create.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_Create.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_DeleteById.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_DeleteById.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_DeleteById.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_DeleteById.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_ReadById.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_ReadById.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_ReadById.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_ReadById.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_ReadByInvoiceId.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_ReadByInvoiceId.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_ReadByInvoiceId.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_ReadByInvoiceId.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_ReadByProviderId.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_ReadByProviderId.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_ReadByProviderId.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_ReadByProviderId.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_Update.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_Update.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderInvoiceItem_Update.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderInvoiceItem_Update.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_Create.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_Create.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_Create.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_Create.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_DeleteById.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_DeleteById.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_DeleteById.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_DeleteById.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_ReadById.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_ReadById.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_ReadById.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_ReadById.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_ReadByProviderId.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_ReadByProviderId.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_ReadByProviderId.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_ReadByProviderId.sql
diff --git a/src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_Update.sql b/src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_Update.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Stored Procedures/ProviderPlan_Update.sql
rename to src/Sql/dbo/Billing/Stored Procedures/ProviderPlan_Update.sql
diff --git a/src/Sql/Billing/dbo/Tables/ClientOrganizationMigrationRecord.sql b/src/Sql/dbo/Billing/Tables/ClientOrganizationMigrationRecord.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Tables/ClientOrganizationMigrationRecord.sql
rename to src/Sql/dbo/Billing/Tables/ClientOrganizationMigrationRecord.sql
diff --git a/src/Sql/Billing/dbo/Tables/OrganizationInstallation.sql b/src/Sql/dbo/Billing/Tables/OrganizationInstallation.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Tables/OrganizationInstallation.sql
rename to src/Sql/dbo/Billing/Tables/OrganizationInstallation.sql
diff --git a/src/Sql/Billing/dbo/Tables/ProviderInvoiceItem.sql b/src/Sql/dbo/Billing/Tables/ProviderInvoiceItem.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Tables/ProviderInvoiceItem.sql
rename to src/Sql/dbo/Billing/Tables/ProviderInvoiceItem.sql
diff --git a/src/Sql/Billing/dbo/Tables/ProviderPlan.sql b/src/Sql/dbo/Billing/Tables/ProviderPlan.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Tables/ProviderPlan.sql
rename to src/Sql/dbo/Billing/Tables/ProviderPlan.sql
diff --git a/src/Sql/Billing/dbo/Views/ClientOrganizationMigrationRecordView.sql b/src/Sql/dbo/Billing/Views/ClientOrganizationMigrationRecordView.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Views/ClientOrganizationMigrationRecordView.sql
rename to src/Sql/dbo/Billing/Views/ClientOrganizationMigrationRecordView.sql
diff --git a/src/Sql/Billing/dbo/Views/OrganizationInstallationView.sql b/src/Sql/dbo/Billing/Views/OrganizationInstallationView.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Views/OrganizationInstallationView.sql
rename to src/Sql/dbo/Billing/Views/OrganizationInstallationView.sql
diff --git a/src/Sql/Billing/dbo/Views/ProviderInvoiceItemView.sql b/src/Sql/dbo/Billing/Views/ProviderInvoiceItemView.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Views/ProviderInvoiceItemView.sql
rename to src/Sql/dbo/Billing/Views/ProviderInvoiceItemView.sql
diff --git a/src/Sql/Billing/dbo/Views/ProviderPlanView.sql b/src/Sql/dbo/Billing/Views/ProviderPlanView.sql
similarity index 100%
rename from src/Sql/Billing/dbo/Views/ProviderPlanView.sql
rename to src/Sql/dbo/Billing/Views/ProviderPlanView.sql
diff --git a/src/Sql/KeyManagement/dbo/Stored Procedures/UserAsymmetricKeys_Regenerate.sql b/src/Sql/dbo/KeyManagement/Stored Procedures/UserAsymmetricKeys_Regenerate.sql
similarity index 100%
rename from src/Sql/KeyManagement/dbo/Stored Procedures/UserAsymmetricKeys_Regenerate.sql
rename to src/Sql/dbo/KeyManagement/Stored Procedures/UserAsymmetricKeys_Regenerate.sql
diff --git a/src/Sql/Platform/dbo/Stored Procedures/Installation_Create.sql b/src/Sql/dbo/Platform/Stored Procedures/Installation_Create.sql
similarity index 100%
rename from src/Sql/Platform/dbo/Stored Procedures/Installation_Create.sql
rename to src/Sql/dbo/Platform/Stored Procedures/Installation_Create.sql
diff --git a/src/Sql/Platform/dbo/Stored Procedures/Installation_DeleteById.sql b/src/Sql/dbo/Platform/Stored Procedures/Installation_DeleteById.sql
similarity index 100%
rename from src/Sql/Platform/dbo/Stored Procedures/Installation_DeleteById.sql
rename to src/Sql/dbo/Platform/Stored Procedures/Installation_DeleteById.sql
diff --git a/src/Sql/Platform/dbo/Stored Procedures/Installation_ReadById.sql b/src/Sql/dbo/Platform/Stored Procedures/Installation_ReadById.sql
similarity index 100%
rename from src/Sql/Platform/dbo/Stored Procedures/Installation_ReadById.sql
rename to src/Sql/dbo/Platform/Stored Procedures/Installation_ReadById.sql
diff --git a/src/Sql/Platform/dbo/Stored Procedures/Installation_Update.sql b/src/Sql/dbo/Platform/Stored Procedures/Installation_Update.sql
similarity index 100%
rename from src/Sql/Platform/dbo/Stored Procedures/Installation_Update.sql
rename to src/Sql/dbo/Platform/Stored Procedures/Installation_Update.sql
diff --git a/src/Sql/Platform/dbo/Tables/Installation.sql b/src/Sql/dbo/Platform/Tables/Installation.sql
similarity index 100%
rename from src/Sql/Platform/dbo/Tables/Installation.sql
rename to src/Sql/dbo/Platform/Tables/Installation.sql
diff --git a/src/Sql/Platform/dbo/Views/InstallationView.sql b/src/Sql/dbo/Platform/Views/InstallationView.sql
similarity index 100%
rename from src/Sql/Platform/dbo/Views/InstallationView.sql
rename to src/Sql/dbo/Platform/Views/InstallationView.sql
diff --git a/src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKeyDetails_ReadById.sql b/src/Sql/dbo/SecretsManager/Stored Procedures/ApiKey/ApiKeyDetails_ReadById.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKeyDetails_ReadById.sql
rename to src/Sql/dbo/SecretsManager/Stored Procedures/ApiKey/ApiKeyDetails_ReadById.sql
diff --git a/src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_Create.sql b/src/Sql/dbo/SecretsManager/Stored Procedures/ApiKey/ApiKey_Create.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_Create.sql
rename to src/Sql/dbo/SecretsManager/Stored Procedures/ApiKey/ApiKey_Create.sql
diff --git a/src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_DeleteByIds.sql b/src/Sql/dbo/SecretsManager/Stored Procedures/ApiKey/ApiKey_DeleteByIds.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_DeleteByIds.sql
rename to src/Sql/dbo/SecretsManager/Stored Procedures/ApiKey/ApiKey_DeleteByIds.sql
diff --git a/src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_ReadByServiceAccountId.sql b/src/Sql/dbo/SecretsManager/Stored Procedures/ApiKey/ApiKey_ReadByServiceAccountId.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Stored Procedures/ApiKey/ApiKey_ReadByServiceAccountId.sql
rename to src/Sql/dbo/SecretsManager/Stored Procedures/ApiKey/ApiKey_ReadByServiceAccountId.sql
diff --git a/src/Sql/SecretsManager/dbo/Stored Procedures/Event/Event_ReadPageByOrganizationIdServiceAccountId.sql b/src/Sql/dbo/SecretsManager/Stored Procedures/Event/Event_ReadPageByOrganizationIdServiceAccountId.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Stored Procedures/Event/Event_ReadPageByOrganizationIdServiceAccountId.sql
rename to src/Sql/dbo/SecretsManager/Stored Procedures/Event/Event_ReadPageByOrganizationIdServiceAccountId.sql
diff --git a/src/Sql/SecretsManager/dbo/Tables/AccessPolicy.sql b/src/Sql/dbo/SecretsManager/Tables/AccessPolicy.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Tables/AccessPolicy.sql
rename to src/Sql/dbo/SecretsManager/Tables/AccessPolicy.sql
diff --git a/src/Sql/SecretsManager/dbo/Tables/ApiKey.sql b/src/Sql/dbo/SecretsManager/Tables/ApiKey.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Tables/ApiKey.sql
rename to src/Sql/dbo/SecretsManager/Tables/ApiKey.sql
diff --git a/src/Sql/SecretsManager/dbo/Tables/Project.sql b/src/Sql/dbo/SecretsManager/Tables/Project.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Tables/Project.sql
rename to src/Sql/dbo/SecretsManager/Tables/Project.sql
diff --git a/src/Sql/SecretsManager/dbo/Tables/ProjectSecret.sql b/src/Sql/dbo/SecretsManager/Tables/ProjectSecret.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Tables/ProjectSecret.sql
rename to src/Sql/dbo/SecretsManager/Tables/ProjectSecret.sql
diff --git a/src/Sql/SecretsManager/dbo/Tables/Secret.sql b/src/Sql/dbo/SecretsManager/Tables/Secret.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Tables/Secret.sql
rename to src/Sql/dbo/SecretsManager/Tables/Secret.sql
diff --git a/src/Sql/SecretsManager/dbo/Tables/ServiceAccount.sql b/src/Sql/dbo/SecretsManager/Tables/ServiceAccount.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Tables/ServiceAccount.sql
rename to src/Sql/dbo/SecretsManager/Tables/ServiceAccount.sql
diff --git a/src/Sql/SecretsManager/dbo/Views/ApiKeyDetailsView.sql b/src/Sql/dbo/SecretsManager/Views/ApiKeyDetailsView.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Views/ApiKeyDetailsView.sql
rename to src/Sql/dbo/SecretsManager/Views/ApiKeyDetailsView.sql
diff --git a/src/Sql/SecretsManager/dbo/Views/ApiKeyView.sql b/src/Sql/dbo/SecretsManager/Views/ApiKeyView.sql
similarity index 100%
rename from src/Sql/SecretsManager/dbo/Views/ApiKeyView.sql
rename to src/Sql/dbo/SecretsManager/Views/ApiKeyView.sql
diff --git a/src/Sql/dbo/Stored Procedures/Collection_Create.sql b/src/Sql/dbo/Stored Procedures/Collection_Create.sql
index 2e442c6a28..2b3b14fd6b 100644
--- a/src/Sql/dbo/Stored Procedures/Collection_Create.sql
+++ b/src/Sql/dbo/Stored Procedures/Collection_Create.sql
@@ -4,7 +4,9 @@
@Name VARCHAR(MAX),
@ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7),
- @RevisionDate DATETIME2(7)
+ @RevisionDate DATETIME2(7),
+ @DefaultUserCollectionEmail NVARCHAR(256) = NULL,
+ @Type TINYINT = 0
AS
BEGIN
SET NOCOUNT ON
@@ -16,7 +18,9 @@ BEGIN
[Name],
[ExternalId],
[CreationDate],
- [RevisionDate]
+ [RevisionDate],
+ [DefaultUserCollectionEmail],
+ [Type]
)
VALUES
(
@@ -25,7 +29,9 @@ BEGIN
@Name,
@ExternalId,
@CreationDate,
- @RevisionDate
+ @RevisionDate,
+ @DefaultUserCollectionEmail,
+ @Type
)
EXEC [dbo].[User_BumpAccountRevisionDateByCollectionId] @Id, @OrganizationId
diff --git a/src/Sql/dbo/Stored Procedures/Collection_CreateWithGroupsAndUsers.sql b/src/Sql/dbo/Stored Procedures/Collection_CreateWithGroupsAndUsers.sql
index 87bac3b385..92ffd366e6 100644
--- a/src/Sql/dbo/Stored Procedures/Collection_CreateWithGroupsAndUsers.sql
+++ b/src/Sql/dbo/Stored Procedures/Collection_CreateWithGroupsAndUsers.sql
@@ -6,12 +6,14 @@ CREATE PROCEDURE [dbo].[Collection_CreateWithGroupsAndUsers]
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7),
@Groups AS [dbo].[CollectionAccessSelectionType] READONLY,
- @Users AS [dbo].[CollectionAccessSelectionType] READONLY
+ @Users AS [dbo].[CollectionAccessSelectionType] READONLY,
+ @DefaultUserCollectionEmail NVARCHAR(256) = NULL,
+ @Type TINYINT = 0
AS
BEGIN
SET NOCOUNT ON
- EXEC [dbo].[Collection_Create] @Id, @OrganizationId, @Name, @ExternalId, @CreationDate, @RevisionDate
+ EXEC [dbo].[Collection_Create] @Id, @OrganizationId, @Name, @ExternalId, @CreationDate, @RevisionDate, @DefaultUserCollectionEmail, @Type
-- Groups
;WITH [AvailableGroupsCTE] AS(
diff --git a/src/Sql/dbo/Stored Procedures/Collection_ReadByUserId.sql b/src/Sql/dbo/Stored Procedures/Collection_ReadByUserId.sql
index f0eab509ac..4180dc6909 100644
--- a/src/Sql/dbo/Stored Procedures/Collection_ReadByUserId.sql
+++ b/src/Sql/dbo/Stored Procedures/Collection_ReadByUserId.sql
@@ -13,7 +13,9 @@ BEGIN
ExternalId,
MIN([ReadOnly]) AS [ReadOnly],
MIN([HidePasswords]) AS [HidePasswords],
- MAX([Manage]) AS [Manage]
+ MAX([Manage]) AS [Manage],
+ [DefaultUserCollectionEmail],
+ [Type]
FROM
[dbo].[UserCollectionDetails](@UserId)
GROUP BY
@@ -22,5 +24,7 @@ BEGIN
[Name],
CreationDate,
RevisionDate,
- ExternalId
+ ExternalId,
+ [DefaultUserCollectionEmail],
+ [Type]
END
diff --git a/src/Sql/dbo/Stored Procedures/Collection_Update.sql b/src/Sql/dbo/Stored Procedures/Collection_Update.sql
index e75f088d7d..69a009e27a 100644
--- a/src/Sql/dbo/Stored Procedures/Collection_Update.sql
+++ b/src/Sql/dbo/Stored Procedures/Collection_Update.sql
@@ -4,7 +4,9 @@
@Name VARCHAR(MAX),
@ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7),
- @RevisionDate DATETIME2(7)
+ @RevisionDate DATETIME2(7),
+ @DefaultUserCollectionEmail NVARCHAR(256) = NULL,
+ @Type TINYINT = 0
AS
BEGIN
SET NOCOUNT ON
@@ -16,9 +18,11 @@ BEGIN
[Name] = @Name,
[ExternalId] = @ExternalId,
[CreationDate] = @CreationDate,
- [RevisionDate] = @RevisionDate
+ [RevisionDate] = @RevisionDate,
+ [DefaultUserCollectionEmail] = @DefaultUserCollectionEmail,
+ [Type] = @Type
WHERE
[Id] = @Id
EXEC [dbo].[User_BumpAccountRevisionDateByCollectionId] @Id, @OrganizationId
-END
\ No newline at end of file
+END
diff --git a/src/Sql/dbo/Stored Procedures/Collection_UpdateWithGroupsAndUsers.sql b/src/Sql/dbo/Stored Procedures/Collection_UpdateWithGroupsAndUsers.sql
index 4a66b20d86..29894f984b 100644
--- a/src/Sql/dbo/Stored Procedures/Collection_UpdateWithGroupsAndUsers.sql
+++ b/src/Sql/dbo/Stored Procedures/Collection_UpdateWithGroupsAndUsers.sql
@@ -6,12 +6,14 @@
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7),
@Groups AS [dbo].[CollectionAccessSelectionType] READONLY,
- @Users AS [dbo].[CollectionAccessSelectionType] READONLY
+ @Users AS [dbo].[CollectionAccessSelectionType] READONLY,
+ @DefaultUserCollectionEmail NVARCHAR(256) = NULL,
+ @Type TINYINT = 0
AS
BEGIN
SET NOCOUNT ON
- EXEC [dbo].[Collection_Update] @Id, @OrganizationId, @Name, @ExternalId, @CreationDate, @RevisionDate
+ EXEC [dbo].[Collection_Update] @Id, @OrganizationId, @Name, @ExternalId, @CreationDate, @RevisionDate, @DefaultUserCollectionEmail, @Type
-- Groups
-- Delete groups that are no longer in source
diff --git a/src/Sql/NotificationCenter/dbo/Stored Procedures/NotificationStatus_Create.sql b/src/Sql/dbo/Stored Procedures/NotificationStatus_Create.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Stored Procedures/NotificationStatus_Create.sql
rename to src/Sql/dbo/Stored Procedures/NotificationStatus_Create.sql
diff --git a/src/Sql/NotificationCenter/dbo/Stored Procedures/NotificationStatus_ReadByNotificationIdAndUserId.sql b/src/Sql/dbo/Stored Procedures/NotificationStatus_ReadByNotificationIdAndUserId.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Stored Procedures/NotificationStatus_ReadByNotificationIdAndUserId.sql
rename to src/Sql/dbo/Stored Procedures/NotificationStatus_ReadByNotificationIdAndUserId.sql
diff --git a/src/Sql/NotificationCenter/dbo/Stored Procedures/NotificationStatus_Update.sql b/src/Sql/dbo/Stored Procedures/NotificationStatus_Update.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Stored Procedures/NotificationStatus_Update.sql
rename to src/Sql/dbo/Stored Procedures/NotificationStatus_Update.sql
diff --git a/src/Sql/NotificationCenter/dbo/Stored Procedures/Notification_Create.sql b/src/Sql/dbo/Stored Procedures/Notification_Create.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Stored Procedures/Notification_Create.sql
rename to src/Sql/dbo/Stored Procedures/Notification_Create.sql
diff --git a/src/Sql/NotificationCenter/dbo/Stored Procedures/Notification_ReadById.sql b/src/Sql/dbo/Stored Procedures/Notification_ReadById.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Stored Procedures/Notification_ReadById.sql
rename to src/Sql/dbo/Stored Procedures/Notification_ReadById.sql
diff --git a/src/Sql/NotificationCenter/dbo/Stored Procedures/Notification_ReadByUserIdAndStatus.sql b/src/Sql/dbo/Stored Procedures/Notification_ReadByUserIdAndStatus.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Stored Procedures/Notification_ReadByUserIdAndStatus.sql
rename to src/Sql/dbo/Stored Procedures/Notification_ReadByUserIdAndStatus.sql
diff --git a/src/Sql/NotificationCenter/dbo/Stored Procedures/Notification_Update.sql b/src/Sql/dbo/Stored Procedures/Notification_Update.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Stored Procedures/Notification_Update.sql
rename to src/Sql/dbo/Stored Procedures/Notification_Update.sql
diff --git a/src/Sql/dbo/Tables/Collection.sql b/src/Sql/dbo/Tables/Collection.sql
index 0106f341df..03064fd978 100644
--- a/src/Sql/dbo/Tables/Collection.sql
+++ b/src/Sql/dbo/Tables/Collection.sql
@@ -1,10 +1,12 @@
CREATE TABLE [dbo].[Collection] (
- [Id] UNIQUEIDENTIFIER NOT NULL,
- [OrganizationId] UNIQUEIDENTIFIER NOT NULL,
- [Name] VARCHAR (MAX) NOT NULL,
- [ExternalId] NVARCHAR (300) NULL,
- [CreationDate] DATETIME2 (7) NOT NULL,
- [RevisionDate] DATETIME2 (7) NOT NULL,
+ [Id] UNIQUEIDENTIFIER NOT NULL,
+ [OrganizationId] UNIQUEIDENTIFIER NOT NULL,
+ [Name] VARCHAR (MAX) NOT NULL,
+ [ExternalId] NVARCHAR (300) NULL,
+ [CreationDate] DATETIME2 (7) NOT NULL,
+ [RevisionDate] DATETIME2 (7) NOT NULL,
+ [DefaultUserCollectionEmail] NVARCHAR(256) NULL,
+ [Type] TINYINT NOT NULL DEFAULT(0),
CONSTRAINT [PK_Collection] PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_Collection_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) ON DELETE CASCADE
);
diff --git a/src/Sql/NotificationCenter/dbo/Tables/Notification.sql b/src/Sql/dbo/Tables/Notification.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Tables/Notification.sql
rename to src/Sql/dbo/Tables/Notification.sql
diff --git a/src/Sql/NotificationCenter/dbo/Tables/NotificationStatus.sql b/src/Sql/dbo/Tables/NotificationStatus.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Tables/NotificationStatus.sql
rename to src/Sql/dbo/Tables/NotificationStatus.sql
diff --git a/src/Sql/Tools/dbo/Stored Procedures/Send_Create.sql b/src/Sql/dbo/Tools/Stored Procedures/Send_Create.sql
similarity index 100%
rename from src/Sql/Tools/dbo/Stored Procedures/Send_Create.sql
rename to src/Sql/dbo/Tools/Stored Procedures/Send_Create.sql
diff --git a/src/Sql/Tools/dbo/Stored Procedures/Send_DeleteById.sql b/src/Sql/dbo/Tools/Stored Procedures/Send_DeleteById.sql
similarity index 100%
rename from src/Sql/Tools/dbo/Stored Procedures/Send_DeleteById.sql
rename to src/Sql/dbo/Tools/Stored Procedures/Send_DeleteById.sql
diff --git a/src/Sql/Tools/dbo/Stored Procedures/Send_ReadByDeletionDateBefore.sql b/src/Sql/dbo/Tools/Stored Procedures/Send_ReadByDeletionDateBefore.sql
similarity index 100%
rename from src/Sql/Tools/dbo/Stored Procedures/Send_ReadByDeletionDateBefore.sql
rename to src/Sql/dbo/Tools/Stored Procedures/Send_ReadByDeletionDateBefore.sql
diff --git a/src/Sql/Tools/dbo/Stored Procedures/Send_ReadById.sql b/src/Sql/dbo/Tools/Stored Procedures/Send_ReadById.sql
similarity index 100%
rename from src/Sql/Tools/dbo/Stored Procedures/Send_ReadById.sql
rename to src/Sql/dbo/Tools/Stored Procedures/Send_ReadById.sql
diff --git a/src/Sql/Tools/dbo/Stored Procedures/Send_ReadByUserId.sql b/src/Sql/dbo/Tools/Stored Procedures/Send_ReadByUserId.sql
similarity index 100%
rename from src/Sql/Tools/dbo/Stored Procedures/Send_ReadByUserId.sql
rename to src/Sql/dbo/Tools/Stored Procedures/Send_ReadByUserId.sql
diff --git a/src/Sql/Tools/dbo/Stored Procedures/Send_Update.sql b/src/Sql/dbo/Tools/Stored Procedures/Send_Update.sql
similarity index 100%
rename from src/Sql/Tools/dbo/Stored Procedures/Send_Update.sql
rename to src/Sql/dbo/Tools/Stored Procedures/Send_Update.sql
diff --git a/src/Sql/Tools/dbo/Tables/Send.sql b/src/Sql/dbo/Tools/Tables/Send.sql
similarity index 100%
rename from src/Sql/Tools/dbo/Tables/Send.sql
rename to src/Sql/dbo/Tools/Tables/Send.sql
diff --git a/src/Sql/Tools/dbo/Views/SendView.sql b/src/Sql/dbo/Tools/Views/SendView.sql
similarity index 100%
rename from src/Sql/Tools/dbo/Views/SendView.sql
rename to src/Sql/dbo/Tools/Views/SendView.sql
diff --git a/src/Sql/Vault/dbo/Functions/CipherDetails.sql b/src/Sql/dbo/Vault/Functions/CipherDetails.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Functions/CipherDetails.sql
rename to src/Sql/dbo/Vault/Functions/CipherDetails.sql
diff --git a/src/Sql/Vault/dbo/Functions/UserCipherDetails.sql b/src/Sql/dbo/Vault/Functions/UserCipherDetails.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Functions/UserCipherDetails.sql
rename to src/Sql/dbo/Vault/Functions/UserCipherDetails.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_Create.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_Create.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_Create.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_Create.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_CreateWithCollections.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_CreateWithCollections.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_CreateWithCollections.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_CreateWithCollections.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadByIdUserId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_ReadByIdUserId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadByIdUserId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_ReadByIdUserId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadByUserId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_ReadByUserId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadByUserId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_ReadByUserId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadWithoutOrganizationsByUserId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_ReadWithoutOrganizationsByUserId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_ReadWithoutOrganizationsByUserId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_ReadWithoutOrganizationsByUserId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_Update.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_Update.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherDetails_Update.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherDetails_Update.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadById.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherOrganizationDetails_ReadById.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadById.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherOrganizationDetails_ReadById.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadByOrganizationId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherOrganizationDetails_ReadByOrganizationId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadByOrganizationId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherOrganizationDetails_ReadByOrganizationId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadUnassignedByOrganizationId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherOrganizationDetails_ReadUnassignedByOrganizationId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationDetails_ReadUnassignedByOrganizationId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherOrganizationDetails_ReadUnassignedByOrganizationId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationPermissions_GetManyByOrganizationId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherOrganizationPermissions_GetManyByOrganizationId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/CipherOrganizationPermissions_GetManyByOrganizationId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/CipherOrganizationPermissions_GetManyByOrganizationId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Create.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Create.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Create.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Create.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_CreateWithCollections.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_CreateWithCollections.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_CreateWithCollections.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_CreateWithCollections.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Delete.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Delete.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Delete.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Delete.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteAttachment.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteAttachment.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteAttachment.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteAttachment.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteById.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteById.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteById.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteById.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByIdsOrganizationId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteByIdsOrganizationId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByIdsOrganizationId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteByIdsOrganizationId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByOrganizationId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteByOrganizationId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByOrganizationId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteByOrganizationId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByUserId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteByUserId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteByUserId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteByUserId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteDeleted.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteDeleted.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_DeleteDeleted.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_DeleteDeleted.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Move.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Move.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Move.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Move.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadById.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_ReadById.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadById.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_ReadById.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadByOrganizationId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_ReadByOrganizationId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadByOrganizationId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_ReadByOrganizationId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadCanEditByIdUserId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_ReadCanEditByIdUserId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_ReadCanEditByIdUserId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_ReadCanEditByIdUserId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Restore.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Restore.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Restore.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Restore.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_RestoreByIdsOrganizationId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_RestoreByIdsOrganizationId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_RestoreByIdsOrganizationId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_RestoreByIdsOrganizationId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_SoftDelete.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_SoftDelete.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_SoftDelete.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_SoftDelete.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_SoftDeleteByIdsOrganizationId.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_SoftDeleteByIdsOrganizationId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_SoftDeleteByIdsOrganizationId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_SoftDeleteByIdsOrganizationId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Update.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Update.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_Update.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_Update.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateAttachment.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_UpdateAttachment.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateAttachment.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_UpdateAttachment.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateCollections.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_UpdateCollections.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateCollections.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_UpdateCollections.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdatePartial.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_UpdatePartial.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdatePartial.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_UpdatePartial.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateWithCollections.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_UpdateWithCollections.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/Cipher_UpdateWithCollections.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/Cipher_UpdateWithCollections.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Cipher/UserSecurityTasks_GetManyByCipherIds.sql b/src/Sql/dbo/Vault/Stored Procedures/Cipher/UserSecurityTasks_GetManyByCipherIds.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Cipher/UserSecurityTasks_GetManyByCipherIds.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Cipher/UserSecurityTasks_GetManyByCipherIds.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/CollectionCipher/CollectionCipher_AddCollectionsForManyCiphers.sql b/src/Sql/dbo/Vault/Stored Procedures/CollectionCipher/CollectionCipher_AddCollectionsForManyCiphers.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/CollectionCipher/CollectionCipher_AddCollectionsForManyCiphers.sql
rename to src/Sql/dbo/Vault/Stored Procedures/CollectionCipher/CollectionCipher_AddCollectionsForManyCiphers.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/CollectionCipher/CollectionCipher_RemoveCollectionsFromManyCiphers.sql b/src/Sql/dbo/Vault/Stored Procedures/CollectionCipher/CollectionCipher_RemoveCollectionsFromManyCiphers.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/CollectionCipher/CollectionCipher_RemoveCollectionsFromManyCiphers.sql
rename to src/Sql/dbo/Vault/Stored Procedures/CollectionCipher/CollectionCipher_RemoveCollectionsFromManyCiphers.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Collections/Collection_ReadByIdWithPermissions.sql b/src/Sql/dbo/Vault/Stored Procedures/Collections/Collection_ReadByIdWithPermissions.sql
similarity index 96%
rename from src/Sql/Vault/dbo/Stored Procedures/Collections/Collection_ReadByIdWithPermissions.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Collections/Collection_ReadByIdWithPermissions.sql
index 3bb50a51cf..9f2caeb87f 100644
--- a/src/Sql/Vault/dbo/Stored Procedures/Collections/Collection_ReadByIdWithPermissions.sql
+++ b/src/Sql/dbo/Vault/Stored Procedures/Collections/Collection_ReadByIdWithPermissions.sql
@@ -73,7 +73,9 @@ BEGIN
C.[Name],
C.[CreationDate],
C.[RevisionDate],
- C.[ExternalId]
+ C.[ExternalId],
+ C.[DefaultUserCollectionEmail],
+ C.[Type]
IF (@IncludeAccessRelationships = 1)
BEGIN
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Collections/Collection_ReadByOrganizationIdWithPermissions.sql b/src/Sql/dbo/Vault/Stored Procedures/Collections/Collection_ReadByOrganizationIdWithPermissions.sql
similarity index 97%
rename from src/Sql/Vault/dbo/Stored Procedures/Collections/Collection_ReadByOrganizationIdWithPermissions.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Collections/Collection_ReadByOrganizationIdWithPermissions.sql
index 2c99282eef..267024f56c 100644
--- a/src/Sql/Vault/dbo/Stored Procedures/Collections/Collection_ReadByOrganizationIdWithPermissions.sql
+++ b/src/Sql/dbo/Vault/Stored Procedures/Collections/Collection_ReadByOrganizationIdWithPermissions.sql
@@ -73,7 +73,9 @@ BEGIN
C.[Name],
C.[CreationDate],
C.[RevisionDate],
- C.[ExternalId]
+ C.[ExternalId],
+ C.[DefaultUserCollectionEmail],
+ C.[Type]
IF (@IncludeAccessRelationships = 1)
BEGIN
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_Create.sql b/src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_Create.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_Create.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_Create.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_DeleteById.sql b/src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_DeleteById.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_DeleteById.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_DeleteById.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_ReadById.sql b/src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_ReadById.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_ReadById.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_ReadById.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_ReadByUserId.sql b/src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_ReadByUserId.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_ReadByUserId.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_ReadByUserId.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_Update.sql b/src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_Update.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/Folder/Folder_Update.sql
rename to src/Sql/dbo/Vault/Stored Procedures/Folder/Folder_Update.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_Create.sql b/src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_Create.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_Create.sql
rename to src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_Create.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_CreateMany.sql b/src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_CreateMany.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_CreateMany.sql
rename to src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_CreateMany.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_ReadById.sql b/src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_ReadById.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_ReadById.sql
rename to src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_ReadById.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_ReadByOrganizationIdStatus.sql b/src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_ReadByOrganizationIdStatus.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_ReadByOrganizationIdStatus.sql
rename to src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_ReadByOrganizationIdStatus.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_ReadByUserIdStatus.sql b/src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_ReadByUserIdStatus.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_ReadByUserIdStatus.sql
rename to src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_ReadByUserIdStatus.sql
diff --git a/src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_Update.sql b/src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_Update.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Stored Procedures/SecurityTask/SecurityTask_Update.sql
rename to src/Sql/dbo/Vault/Stored Procedures/SecurityTask/SecurityTask_Update.sql
diff --git a/src/Sql/Vault/dbo/Tables/Cipher.sql b/src/Sql/dbo/Vault/Tables/Cipher.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Tables/Cipher.sql
rename to src/Sql/dbo/Vault/Tables/Cipher.sql
diff --git a/src/Sql/Vault/dbo/Tables/Folder.sql b/src/Sql/dbo/Vault/Tables/Folder.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Tables/Folder.sql
rename to src/Sql/dbo/Vault/Tables/Folder.sql
diff --git a/src/Sql/Vault/dbo/Tables/SecurityTask.sql b/src/Sql/dbo/Vault/Tables/SecurityTask.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Tables/SecurityTask.sql
rename to src/Sql/dbo/Vault/Tables/SecurityTask.sql
diff --git a/src/Sql/Vault/dbo/Views/CipherView.sql b/src/Sql/dbo/Vault/Views/CipherView.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Views/CipherView.sql
rename to src/Sql/dbo/Vault/Views/CipherView.sql
diff --git a/src/Sql/Vault/dbo/Views/FolderView.sql b/src/Sql/dbo/Vault/Views/FolderView.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Views/FolderView.sql
rename to src/Sql/dbo/Vault/Views/FolderView.sql
diff --git a/src/Sql/Vault/dbo/Views/SecurityTaskView.sql b/src/Sql/dbo/Vault/Views/SecurityTaskView.sql
similarity index 100%
rename from src/Sql/Vault/dbo/Views/SecurityTaskView.sql
rename to src/Sql/dbo/Vault/Views/SecurityTaskView.sql
diff --git a/src/Sql/NotificationCenter/dbo/Views/NotificationStatusDetailsView.sql b/src/Sql/dbo/Views/NotificationStatusDetailsView.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Views/NotificationStatusDetailsView.sql
rename to src/Sql/dbo/Views/NotificationStatusDetailsView.sql
diff --git a/src/Sql/NotificationCenter/dbo/Views/NotificationStatusView.sql b/src/Sql/dbo/Views/NotificationStatusView.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Views/NotificationStatusView.sql
rename to src/Sql/dbo/Views/NotificationStatusView.sql
diff --git a/src/Sql/NotificationCenter/dbo/Views/NotificationView.sql b/src/Sql/dbo/Views/NotificationView.sql
similarity index 100%
rename from src/Sql/NotificationCenter/dbo/Views/NotificationView.sql
rename to src/Sql/dbo/Views/NotificationView.sql
diff --git a/test/Api.Test/Dirt/ReportsControllerTests.cs b/test/Api.Test/Dirt/ReportsControllerTests.cs
index 3057e10641..37a6cb79c3 100644
--- a/test/Api.Test/Dirt/ReportsControllerTests.cs
+++ b/test/Api.Test/Dirt/ReportsControllerTests.cs
@@ -1,15 +1,16 @@
using AutoFixture;
-using Bit.Api.Tools.Controllers;
+using Bit.Api.Dirt.Controllers;
+using Bit.Api.Dirt.Models;
using Bit.Core.Context;
+using Bit.Core.Dirt.Reports.ReportFeatures.Interfaces;
+using Bit.Core.Dirt.Reports.ReportFeatures.Requests;
using Bit.Core.Exceptions;
-using Bit.Core.Tools.ReportFeatures.Interfaces;
-using Bit.Core.Tools.ReportFeatures.Requests;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;
using NSubstitute;
using Xunit;
-namespace Bit.Api.Test.Tools.Controllers;
+namespace Bit.Api.Test.Dirt;
[ControllerCustomize(typeof(ReportsController))]
@@ -54,7 +55,7 @@ public class ReportsControllerTests
sutProvider.GetDependency().AccessReports(Arg.Any()).Returns(true);
// Act
- var request = new Api.Tools.Models.PasswordHealthReportApplicationModel
+ var request = new PasswordHealthReportApplicationModel
{
OrganizationId = Guid.NewGuid(),
Url = "https://example.com",
@@ -77,7 +78,7 @@ public class ReportsControllerTests
// Act
var fixture = new Fixture();
- var request = fixture.CreateMany(2);
+ var request = fixture.CreateMany(2);
await sutProvider.Sut.AddPasswordHealthReportApplications(request);
// Assert
@@ -93,7 +94,7 @@ public class ReportsControllerTests
sutProvider.GetDependency().AccessReports(Arg.Any()).Returns(false);
// Act
- var request = new Api.Tools.Models.PasswordHealthReportApplicationModel
+ var request = new PasswordHealthReportApplicationModel
{
OrganizationId = Guid.NewGuid(),
Url = "https://example.com",
@@ -114,7 +115,7 @@ public class ReportsControllerTests
// Act
var fixture = new Fixture();
- var request = fixture.Create();
+ var request = fixture.Create();
await Assert.ThrowsAsync(async () =>
await sutProvider.Sut.AddPasswordHealthReportApplication(request));
diff --git a/test/Api.Test/KeyManagement/Controllers/AccountsKeyManagementControllerTests.cs b/test/Api.Test/KeyManagement/Controllers/AccountsKeyManagementControllerTests.cs
index d2775762e8..05b1aa5a4d 100644
--- a/test/Api.Test/KeyManagement/Controllers/AccountsKeyManagementControllerTests.cs
+++ b/test/Api.Test/KeyManagement/Controllers/AccountsKeyManagementControllerTests.cs
@@ -175,7 +175,7 @@ public class AccountsKeyManagementControllerTests
}
catch (BadRequestException ex)
{
- Assert.NotEmpty(ex.ModelState.Values);
+ Assert.NotEmpty(ex.ModelState!.Values);
}
}
@@ -210,7 +210,7 @@ public class AccountsKeyManagementControllerTests
var badRequestException =
await Assert.ThrowsAsync(() => sutProvider.Sut.PostSetKeyConnectorKeyAsync(data));
- Assert.Equal(1, badRequestException.ModelState.ErrorCount);
+ Assert.Equal(1, badRequestException.ModelState!.ErrorCount);
Assert.Equal("set key connector key error", badRequestException.ModelState.Root.Errors[0].ErrorMessage);
await sutProvider.GetDependency().Received(1)
.SetKeyConnectorKeyAsync(Arg.Do(user =>
@@ -284,7 +284,7 @@ public class AccountsKeyManagementControllerTests
var badRequestException =
await Assert.ThrowsAsync(() => sutProvider.Sut.PostConvertToKeyConnectorAsync());
- Assert.Equal(1, badRequestException.ModelState.ErrorCount);
+ Assert.Equal(1, badRequestException.ModelState!.ErrorCount);
Assert.Equal("convert to key connector error", badRequestException.ModelState.Root.Errors[0].ErrorMessage);
await sutProvider.GetDependency().Received(1)
.ConvertToKeyConnectorAsync(Arg.Is(expectedUser));
diff --git a/test/Api.Test/Vault/Controllers/CiphersControllerTests.cs b/test/Api.Test/Vault/Controllers/CiphersControllerTests.cs
index bca6bbc048..d1f5a212c9 100644
--- a/test/Api.Test/Vault/Controllers/CiphersControllerTests.cs
+++ b/test/Api.Test/Vault/Controllers/CiphersControllerTests.cs
@@ -4,7 +4,6 @@ using Bit.Api.Vault.Controllers;
using Bit.Api.Vault.Models;
using Bit.Api.Vault.Models.Request;
using Bit.Api.Vault.Models.Response;
-using Bit.Core;
using Bit.Core.Context;
using Bit.Core.Entities;
using Bit.Core.Enums;
@@ -169,6 +168,7 @@ public class CiphersControllerTests
}
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
@@ -197,65 +197,7 @@ public class CiphersControllerTests
[Theory]
[BitAutoData(OrganizationUserType.Owner)]
[BitAutoData(OrganizationUserType.Admin)]
- public async Task DeleteAdmin_WithOwnerOrAdmin_WithEditPermission_DeletesCipher(
- OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- cipherDetails.UserId = null;
- cipherDetails.OrganizationId = organization.Id;
- cipherDetails.Edit = true;
- cipherDetails.Manage = false;
-
- organization.Type = organizationUserType;
-
- sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
- sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
- sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
- sutProvider.GetDependency()
- .GetManyByUserIdAsync(userId)
- .Returns(new List
- {
- cipherDetails
- });
-
- await sutProvider.Sut.DeleteAdmin(cipherDetails.Id);
-
- await sutProvider.GetDependency().Received(1).DeleteAsync(cipherDetails, userId, true);
- }
-
- [Theory]
- [BitAutoData(OrganizationUserType.Owner)]
- [BitAutoData(OrganizationUserType.Admin)]
- public async Task DeleteAdmin_WithOwnerOrAdmin_WithoutEditPermission_ThrowsNotFoundException(
- OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- cipherDetails.UserId = null;
- cipherDetails.OrganizationId = organization.Id;
- cipherDetails.Edit = false;
- cipherDetails.Manage = false;
-
- organization.Type = organizationUserType;
-
- sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
- sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
- sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
- sutProvider.GetDependency()
- .GetManyByUserIdAsync(userId)
- .Returns(new List
- {
- cipherDetails
- });
-
- await Assert.ThrowsAsync(() => sutProvider.Sut.DeleteAdmin(cipherDetails.Id));
-
- await sutProvider.GetDependency().DidNotReceive().DeleteAsync(Arg.Any(), Arg.Any(), Arg.Any());
- }
-
- [Theory]
- [BitAutoData(OrganizationUserType.Owner)]
- [BitAutoData(OrganizationUserType.Admin)]
- public async Task DeleteAdmin_WithLimitItemDeletionEnabled_WithOwnerOrAdmin_WithManagePermission_DeletesCipher(
+ public async Task DeleteAdmin_WithOwnerOrAdmin_WithManagePermission_DeletesCipher(
OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
CurrentContextOrganization organization, SutProvider sutProvider)
{
@@ -266,7 +208,6 @@ public class CiphersControllerTests
organization.Type = organizationUserType;
- sutProvider.GetDependency().IsEnabled(FeatureFlagKeys.LimitItemDeletion).Returns(true);
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
@@ -293,7 +234,7 @@ public class CiphersControllerTests
[Theory]
[BitAutoData(OrganizationUserType.Owner)]
[BitAutoData(OrganizationUserType.Admin)]
- public async Task DeleteAdmin_WithLimitItemDeletionEnabled_WithOwnerOrAdmin_WithoutManagePermission_ThrowsNotFoundException(
+ public async Task DeleteAdmin_WithOwnerOrAdmin_WithoutManagePermission_ThrowsNotFoundException(
OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
CurrentContextOrganization organization, SutProvider sutProvider)
{
@@ -304,7 +245,6 @@ public class CiphersControllerTests
organization.Type = organizationUserType;
- sutProvider.GetDependency().IsEnabled(FeatureFlagKeys.LimitItemDeletion).Returns(true);
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
@@ -339,11 +279,22 @@ public class CiphersControllerTests
organization.Type = organizationUserType;
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
sutProvider.GetDependency()
.GetManyUnassignedOrganizationDetailsByOrganizationIdAsync(organization.Id)
- .Returns(new List { new() { Id = cipherDetails.Id } });
+ .Returns(new List
+ {
+ new() { Id = cipherDetails.Id, OrganizationId = cipherDetails.OrganizationId }
+ });
+ sutProvider.GetDependency()
+ .GetOrganizationAbilityAsync(organization.Id)
+ .Returns(new OrganizationAbility
+ {
+ Id = organization.Id,
+ LimitItemDeletion = true
+ });
await sutProvider.Sut.DeleteAdmin(cipherDetails.Id);
@@ -426,10 +377,14 @@ public class CiphersControllerTests
await Assert.ThrowsAsync(() => sutProvider.Sut.DeleteAdmin(cipher.Id));
}
+
+
+
+
[Theory]
[BitAutoData(OrganizationUserType.Owner)]
[BitAutoData(OrganizationUserType.Admin)]
- public async Task DeleteManyAdmin_WithOwnerOrAdmin_WithEditPermission_DeletesCiphers(
+ public async Task DeleteManyAdmin_WithOwnerOrAdmin_WithManagePermission_DeletesCiphers(
OrganizationUserType organizationUserType, CipherBulkDeleteRequestModel model, Guid userId, List ciphers,
CurrentContextOrganization organization, SutProvider sutProvider)
{
@@ -437,74 +392,6 @@ public class CiphersControllerTests
model.Ids = ciphers.Select(c => c.Id.ToString()).ToList();
organization.Type = organizationUserType;
- sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
- sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
- sutProvider.GetDependency()
- .GetManyByUserIdAsync(userId)
- .Returns(ciphers.Select(c => new CipherDetails
- {
- Id = c.Id,
- OrganizationId = organization.Id,
- Edit = true
- }).ToList());
-
- await sutProvider.Sut.DeleteManyAdmin(model);
-
- await sutProvider.GetDependency()
- .Received(1)
- .DeleteManyAsync(
- Arg.Is>(ids =>
- ids.All(id => model.Ids.Contains(id.ToString())) && ids.Count() == model.Ids.Count()),
- userId, organization.Id, true);
- }
-
- [Theory]
- [BitAutoData(OrganizationUserType.Owner)]
- [BitAutoData(OrganizationUserType.Admin)]
- public async Task DeleteManyAdmin_WithOwnerOrAdmin_WithoutEditPermission_ThrowsNotFoundException(
- OrganizationUserType organizationUserType, CipherBulkDeleteRequestModel model, Guid userId, List ciphers,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- model.OrganizationId = organization.Id.ToString();
- model.Ids = ciphers.Select(c => c.Id.ToString()).ToList();
-
- organization.Type = organizationUserType;
-
- sutProvider.GetDependency()
- .GetProperUserId(default)
- .ReturnsForAnyArgs(userId);
-
- sutProvider.GetDependency()
- .GetOrganization(new Guid(model.OrganizationId))
- .Returns(organization);
-
- sutProvider.GetDependency()
- .GetManyByOrganizationIdAsync(new Guid(model.OrganizationId))
- .Returns(ciphers);
-
- sutProvider.GetDependency()
- .GetOrganizationAbilityAsync(new Guid(model.OrganizationId))
- .Returns(new OrganizationAbility
- {
- Id = new Guid(model.OrganizationId),
- AllowAdminAccessToAllCollectionItems = false,
- });
-
- await Assert.ThrowsAsync(() => sutProvider.Sut.DeleteManyAdmin(model));
- }
-
- [Theory]
- [BitAutoData(OrganizationUserType.Owner)]
- [BitAutoData(OrganizationUserType.Admin)]
- public async Task DeleteManyAdmin_WithLimitItemDeletionEnabled_WithOwnerOrAdmin_WithManagePermission_DeletesCiphers(
- OrganizationUserType organizationUserType, CipherBulkDeleteRequestModel model, Guid userId, List ciphers,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- model.OrganizationId = organization.Id.ToString();
- model.Ids = ciphers.Select(c => c.Id.ToString()).ToList();
- organization.Type = organizationUserType;
-
- sutProvider.GetDependency().IsEnabled(FeatureFlagKeys.LimitItemDeletion).Returns(true);
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
@@ -540,7 +427,7 @@ public class CiphersControllerTests
[Theory]
[BitAutoData(OrganizationUserType.Owner)]
[BitAutoData(OrganizationUserType.Admin)]
- public async Task DeleteManyAdmin_WithLimitItemDeletionEnabled_WithOwnerOrAdmin_WithoutManagePermission_ThrowsNotFoundException(
+ public async Task DeleteManyAdmin_WithOwnerOrAdmin_WithoutManagePermission_ThrowsNotFoundException(
OrganizationUserType organizationUserType, CipherBulkDeleteRequestModel model, Guid userId, List ciphers,
CurrentContextOrganization organization, SutProvider sutProvider)
{
@@ -548,7 +435,6 @@ public class CiphersControllerTests
model.Ids = ciphers.Select(c => c.Id.ToString()).ToList();
organization.Type = organizationUserType;
- sutProvider.GetDependency().IsEnabled(FeatureFlagKeys.LimitItemDeletion).Returns(true);
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
@@ -586,10 +472,18 @@ public class CiphersControllerTests
organization.Type = organizationUserType;
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
sutProvider.GetDependency()
.GetManyUnassignedOrganizationDetailsByOrganizationIdAsync(organization.Id)
- .Returns(ciphers.Select(c => new CipherOrganizationDetails { Id = c.Id }).ToList());
+ .Returns(ciphers.Select(c => new CipherOrganizationDetails { Id = c.Id, OrganizationId = organization.Id }).ToList());
+ sutProvider.GetDependency()
+ .GetOrganizationAbilityAsync(organization.Id)
+ .Returns(new OrganizationAbility
+ {
+ Id = organization.Id,
+ LimitItemDeletion = true
+ });
await sutProvider.Sut.DeleteManyAdmin(model);
@@ -688,67 +582,14 @@ public class CiphersControllerTests
await Assert.ThrowsAsync(() => sutProvider.Sut.DeleteManyAdmin(model));
}
- [Theory]
- [BitAutoData(OrganizationUserType.Owner)]
- [BitAutoData(OrganizationUserType.Admin)]
- public async Task PutDeleteAdmin_WithOwnerOrAdmin_WithEditPermission_SoftDeletesCipher(
- OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- cipherDetails.UserId = null;
- cipherDetails.OrganizationId = organization.Id;
- cipherDetails.Edit = true;
- organization.Type = organizationUserType;
- sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
- sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
- sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
- sutProvider.GetDependency()
- .GetManyByUserIdAsync(userId)
- .Returns(new List
- {
- cipherDetails
- });
- await sutProvider.Sut.PutDeleteAdmin(cipherDetails.Id);
-
- await sutProvider.GetDependency().Received(1).SoftDeleteAsync(cipherDetails, userId, true);
- }
[Theory]
[BitAutoData(OrganizationUserType.Owner)]
[BitAutoData(OrganizationUserType.Admin)]
- public async Task PutDeleteAdmin_WithOwnerOrAdmin_WithoutEditPermission_ThrowsNotFoundException(
- OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- cipherDetails.UserId = null;
- cipherDetails.OrganizationId = organization.Id;
- cipherDetails.Edit = false;
- cipherDetails.Manage = false;
-
- organization.Type = organizationUserType;
-
- sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
- sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
- sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
- sutProvider.GetDependency()
- .GetManyByUserIdAsync(userId)
- .Returns(new List
- {
- cipherDetails
- });
-
- await Assert.ThrowsAsync(() => sutProvider.Sut.PutDeleteAdmin(cipherDetails.Id));
-
- await sutProvider.GetDependency().DidNotReceive().SoftDeleteAsync(Arg.Any(), Arg.Any(), Arg.Any());
- }
-
- [Theory]
- [BitAutoData(OrganizationUserType.Owner)]
- [BitAutoData(OrganizationUserType.Admin)]
- public async Task PutDeleteAdmin_WithLimitItemDeletionEnabled_WithOwnerOrAdmin_WithManagePermission_SoftDeletesCipher(
+ public async Task PutDeleteAdmin_WithOwnerOrAdmin_WithManagePermission_SoftDeletesCipher(
OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
CurrentContextOrganization organization, SutProvider sutProvider)
{
@@ -759,7 +600,6 @@ public class CiphersControllerTests
organization.Type = organizationUserType;
- sutProvider.GetDependency().IsEnabled(FeatureFlagKeys.LimitItemDeletion).Returns(true);
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
@@ -786,7 +626,7 @@ public class CiphersControllerTests
[Theory]
[BitAutoData(OrganizationUserType.Owner)]
[BitAutoData(OrganizationUserType.Admin)]
- public async Task PutDeleteAdmin_WithLimitItemDeletionEnabled_WithOwnerOrAdmin_WithoutManagePermission_ThrowsNotFoundException(
+ public async Task PutDeleteAdmin_WithOwnerOrAdmin_WithoutManagePermission_ThrowsNotFoundException(
OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
CurrentContextOrganization organization, SutProvider sutProvider)
{
@@ -797,7 +637,6 @@ public class CiphersControllerTests
organization.Type = organizationUserType;
- sutProvider.GetDependency().IsEnabled(FeatureFlagKeys.LimitItemDeletion).Returns(true);
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
@@ -833,12 +672,20 @@ public class CiphersControllerTests
organization.Type = organizationUserType;
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
sutProvider.GetDependency()
.GetManyUnassignedOrganizationDetailsByOrganizationIdAsync(organization.Id)
- .Returns(new List { new() { Id = cipherDetails.Id } });
+ .Returns(new List { new() { Id = cipherDetails.Id, OrganizationId = organization.Id } });
+ sutProvider.GetDependency()
+ .GetOrganizationAbilityAsync(organization.Id)
+ .Returns(new OrganizationAbility
+ {
+ Id = organization.Id,
+ LimitItemDeletion = true
+ });
await sutProvider.Sut.PutDeleteAdmin(cipherDetails.Id);
@@ -856,6 +703,7 @@ public class CiphersControllerTests
organization.Type = organizationUserType;
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
sutProvider.GetDependency().GetManyByOrganizationIdAsync(organization.Id).Returns(new List { cipherDetails });
@@ -890,6 +738,70 @@ public class CiphersControllerTests
await sutProvider.GetDependency().Received(1).SoftDeleteAsync(cipherDetails, userId, true);
}
+ [Theory]
+ [BitAutoData(OrganizationUserType.Owner)]
+ [BitAutoData(OrganizationUserType.Admin)]
+ public async Task PutDeleteAdmin_WithOwnerOrAdmin_WithEditPermission_WithLimitItemDeletionFalse_SoftDeletesCipher(
+ OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
+ CurrentContextOrganization organization, SutProvider sutProvider)
+ {
+ cipherDetails.UserId = null;
+ cipherDetails.OrganizationId = organization.Id;
+ cipherDetails.Edit = true;
+ cipherDetails.Manage = false; // Only Edit permission, not Manage
+ organization.Type = organizationUserType;
+
+ sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
+ sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
+ sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
+ sutProvider.GetDependency()
+ .GetManyByUserIdAsync(userId)
+ .Returns(new List { cipherDetails });
+ sutProvider.GetDependency()
+ .GetOrganizationAbilityAsync(organization.Id)
+ .Returns(new OrganizationAbility
+ {
+ Id = organization.Id,
+ LimitItemDeletion = false
+ });
+
+ await sutProvider.Sut.PutDeleteAdmin(cipherDetails.Id);
+
+ await sutProvider.GetDependency().Received(1).SoftDeleteAsync(cipherDetails, userId, true);
+ }
+
+ [Theory]
+ [BitAutoData(OrganizationUserType.Owner)]
+ [BitAutoData(OrganizationUserType.Admin)]
+ public async Task PutDeleteAdmin_WithOwnerOrAdmin_WithEditPermission_WithLimitItemDeletionTrue_ThrowsNotFoundException(
+ OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
+ CurrentContextOrganization organization, SutProvider sutProvider)
+ {
+ cipherDetails.UserId = null;
+ cipherDetails.OrganizationId = organization.Id;
+ cipherDetails.Edit = true;
+ cipherDetails.Manage = false; // Only Edit permission, not Manage
+ organization.Type = organizationUserType;
+
+ sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
+ sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
+ sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
+ sutProvider.GetDependency()
+ .GetManyByUserIdAsync(userId)
+ .Returns(new List { cipherDetails });
+ sutProvider.GetDependency()
+ .GetOrganizationAbilityAsync(organization.Id)
+ .Returns(new OrganizationAbility
+ {
+ Id = organization.Id,
+ LimitItemDeletion = true
+ });
+
+ await Assert.ThrowsAsync(() => sutProvider.Sut.PutDeleteAdmin(cipherDetails.Id));
+ }
+
[Theory]
[BitAutoData]
public async Task PutDeleteAdmin_WithCustomUser_WithEditAnyCollectionFalse_ThrowsNotFoundException(
@@ -922,10 +834,14 @@ public class CiphersControllerTests
await Assert.ThrowsAsync(() => sutProvider.Sut.PutDeleteAdmin(cipher.Id));
}
+
+
+
+
[Theory]
[BitAutoData(OrganizationUserType.Owner)]
[BitAutoData(OrganizationUserType.Admin)]
- public async Task PutDeleteManyAdmin_WithOwnerOrAdmin_WithEditPermission_SoftDeletesCiphers(
+ public async Task PutDeleteManyAdmin_WithOwnerOrAdmin_WithManagePermission_SoftDeletesCiphers(
OrganizationUserType organizationUserType, CipherBulkDeleteRequestModel model, Guid userId, List ciphers,
CurrentContextOrganization organization, SutProvider sutProvider)
{
@@ -933,65 +849,6 @@ public class CiphersControllerTests
model.Ids = ciphers.Select(c => c.Id.ToString()).ToList();
organization.Type = organizationUserType;
- sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
- sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
- sutProvider.GetDependency()
- .GetManyByUserIdAsync(userId)
- .Returns(ciphers.Select(c => new CipherDetails
- {
- Id = c.Id,
- OrganizationId = organization.Id,
- Edit = true
- }).ToList());
-
- await sutProvider.Sut.PutDeleteManyAdmin(model);
-
- await sutProvider.GetDependency()
- .Received(1)
- .SoftDeleteManyAsync(
- Arg.Is>(ids =>
- ids.All(id => model.Ids.Contains(id.ToString())) && ids.Count() == model.Ids.Count()),
- userId, organization.Id, true);
- }
-
- [Theory]
- [BitAutoData(OrganizationUserType.Owner)]
- [BitAutoData(OrganizationUserType.Admin)]
- public async Task PutDeleteManyAdmin_WithOwnerOrAdmin_WithoutEditPermission_ThrowsNotFoundException(
- OrganizationUserType organizationUserType, CipherBulkDeleteRequestModel model, Guid userId, List ciphers,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- model.OrganizationId = organization.Id.ToString();
- model.Ids = ciphers.Select(c => c.Id.ToString()).ToList();
- organization.Type = organizationUserType;
-
- sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
- sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
-
- sutProvider.GetDependency()
- .GetManyByUserIdAsync(userId)
- .Returns(ciphers.Select(c => new CipherDetails
- {
- Id = c.Id,
- OrganizationId = organization.Id,
- Edit = false
- }).ToList());
-
- await Assert.ThrowsAsync(() => sutProvider.Sut.PutDeleteManyAdmin(model));
- }
-
- [Theory]
- [BitAutoData(OrganizationUserType.Owner)]
- [BitAutoData(OrganizationUserType.Admin)]
- public async Task PutDeleteManyAdmin_WithLimitItemDeletionEnabled_WithOwnerOrAdmin_WithManagePermission_SoftDeletesCiphers(
- OrganizationUserType organizationUserType, CipherBulkDeleteRequestModel model, Guid userId, List ciphers,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- model.OrganizationId = organization.Id.ToString();
- model.Ids = ciphers.Select(c => c.Id.ToString()).ToList();
- organization.Type = organizationUserType;
-
- sutProvider.GetDependency().IsEnabled(FeatureFlagKeys.LimitItemDeletion).Returns(true);
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
@@ -1027,7 +884,7 @@ public class CiphersControllerTests
[Theory]
[BitAutoData(OrganizationUserType.Owner)]
[BitAutoData(OrganizationUserType.Admin)]
- public async Task PutDeleteManyAdmin_WithLimitItemDeletionEnabled_WithOwnerOrAdmin_WithoutManagePermission_ThrowsNotFoundException(
+ public async Task PutDeleteManyAdmin_WithOwnerOrAdmin_WithoutManagePermission_ThrowsNotFoundException(
OrganizationUserType organizationUserType, CipherBulkDeleteRequestModel model, Guid userId, List ciphers,
CurrentContextOrganization organization, SutProvider sutProvider)
{
@@ -1035,7 +892,6 @@ public class CiphersControllerTests
model.Ids = ciphers.Select(c => c.Id.ToString()).ToList();
organization.Type = organizationUserType;
- sutProvider.GetDependency().IsEnabled(FeatureFlagKeys.LimitItemDeletion).Returns(true);
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
@@ -1073,10 +929,18 @@ public class CiphersControllerTests
organization.Type = organizationUserType;
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
sutProvider.GetDependency()
.GetManyUnassignedOrganizationDetailsByOrganizationIdAsync(organization.Id)
- .Returns(ciphers.Select(c => new CipherOrganizationDetails { Id = c.Id }).ToList());
+ .Returns(ciphers.Select(c => new CipherOrganizationDetails { Id = c.Id, OrganizationId = organization.Id }).ToList());
+ sutProvider.GetDependency()
+ .GetOrganizationAbilityAsync(organization.Id)
+ .Returns(new OrganizationAbility
+ {
+ Id = organization.Id,
+ LimitItemDeletion = true
+ });
await sutProvider.Sut.PutDeleteManyAdmin(model);
@@ -1099,7 +963,14 @@ public class CiphersControllerTests
model.Ids = ciphers.Select(c => c.Id.ToString()).ToList();
organization.Type = organizationUserType;
+ // Set organization ID on ciphers to avoid "Cipher needs to belong to a user or an organization" error
+ foreach (var cipher in ciphers)
+ {
+ cipher.OrganizationId = organization.Id;
+ }
+
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
sutProvider.GetDependency().GetManyByOrganizationIdAsync(organization.Id).Returns(ciphers);
sutProvider.GetDependency().GetOrganizationAbilityAsync(organization.Id).Returns(new OrganizationAbility
@@ -1130,7 +1001,14 @@ public class CiphersControllerTests
organization.Type = OrganizationUserType.Custom;
organization.Permissions.EditAnyCollection = true;
+ // Set organization ID on ciphers to avoid "Cipher needs to belong to a user or an organization" error
+ foreach (var cipher in ciphers)
+ {
+ cipher.OrganizationId = organization.Id;
+ }
+
sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
+ sutProvider.GetDependency().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(new User { Id = userId });
sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
sutProvider.GetDependency().GetManyByOrganizationIdAsync(organization.Id).Returns(ciphers);
@@ -1175,68 +1053,14 @@ public class CiphersControllerTests
await Assert.ThrowsAsync(() => sutProvider.Sut.PutDeleteManyAdmin(model));
}
- [Theory]
- [BitAutoData(OrganizationUserType.Owner)]
- [BitAutoData(OrganizationUserType.Admin)]
- public async Task PutRestoreAdmin_WithOwnerOrAdmin_WithEditPermission_RestoresCipher(
- OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- cipherDetails.UserId = null;
- cipherDetails.OrganizationId = organization.Id;
- cipherDetails.Type = CipherType.Login;
- cipherDetails.Data = JsonSerializer.Serialize(new CipherLoginData());
- cipherDetails.Edit = true;
- organization.Type = organizationUserType;
- sutProvider.GetDependency().GetProperUserId(default).ReturnsForAnyArgs(userId);
- sutProvider.GetDependency().GetByIdAsync(cipherDetails.Id, userId).Returns(cipherDetails);
- sutProvider.GetDependency().GetOrganization(organization.Id).Returns(organization);
- sutProvider.GetDependency()
- .GetManyByUserIdAsync(userId)
- .Returns(new List
- {
- cipherDetails
- });
- var result = await sutProvider.Sut.PutRestoreAdmin(cipherDetails.Id);
-
- Assert.IsType(result);
- await sutProvider.GetDependency().Received(1).RestoreAsync(cipherDetails, userId, true);
- }
[Theory]
[BitAutoData(OrganizationUserType.Owner)]
[BitAutoData(OrganizationUserType.Admin)]
- public async Task PutRestoreAdmin_WithOwnerOrAdmin_WithoutEditPermission_ThrowsNotFoundException(
- OrganizationUserType organizationUserType, CipherDetails cipherDetails, Guid userId,
- CurrentContextOrganization organization, SutProvider sutProvider)
- {
- cipherDetails.UserId = null;
- cipherDetails.OrganizationId = organization.Id;
- cipherDetails.Edit = false;
- cipherDetails.Manage = false;
-
- organization.Type = organizationUserType;
-
- sutProvider.GetDependency