mirror of
https://github.com/bitwarden/server
synced 2025-12-10 13:23:27 +00:00
[PM-24595] [PM-24596] Remove feature flag usage/definition for deleting users with no mp on import (#6313)
* chore: remove dc prevent non-mp users from being deleted feature flag, refs PM-24596 * chore: format, refs PM-24596
This commit is contained in:
@@ -22,7 +22,6 @@ public class ImportOrganizationUsersAndGroupsCommand : IImportOrganizationUsersA
|
|||||||
private readonly IGroupRepository _groupRepository;
|
private readonly IGroupRepository _groupRepository;
|
||||||
private readonly IEventService _eventService;
|
private readonly IEventService _eventService;
|
||||||
private readonly IOrganizationService _organizationService;
|
private readonly IOrganizationService _organizationService;
|
||||||
private readonly IFeatureService _featureService;
|
|
||||||
|
|
||||||
private readonly EventSystemUser _EventSystemUser = EventSystemUser.PublicApi;
|
private readonly EventSystemUser _EventSystemUser = EventSystemUser.PublicApi;
|
||||||
|
|
||||||
@@ -31,8 +30,7 @@ public class ImportOrganizationUsersAndGroupsCommand : IImportOrganizationUsersA
|
|||||||
IPaymentService paymentService,
|
IPaymentService paymentService,
|
||||||
IGroupRepository groupRepository,
|
IGroupRepository groupRepository,
|
||||||
IEventService eventService,
|
IEventService eventService,
|
||||||
IOrganizationService organizationService,
|
IOrganizationService organizationService)
|
||||||
IFeatureService featureService)
|
|
||||||
{
|
{
|
||||||
_organizationRepository = organizationRepository;
|
_organizationRepository = organizationRepository;
|
||||||
_organizationUserRepository = organizationUserRepository;
|
_organizationUserRepository = organizationUserRepository;
|
||||||
@@ -40,7 +38,6 @@ public class ImportOrganizationUsersAndGroupsCommand : IImportOrganizationUsersA
|
|||||||
_groupRepository = groupRepository;
|
_groupRepository = groupRepository;
|
||||||
_eventService = eventService;
|
_eventService = eventService;
|
||||||
_organizationService = organizationService;
|
_organizationService = organizationService;
|
||||||
_featureService = featureService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -238,8 +235,7 @@ public class ImportOrganizationUsersAndGroupsCommand : IImportOrganizationUsersA
|
|||||||
importUserData.ExistingExternalUsersIdDict.ContainsKey(u.ExternalId))
|
importUserData.ExistingExternalUsersIdDict.ContainsKey(u.ExternalId))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (_featureService.IsEnabled(FeatureFlagKeys.DirectoryConnectorPreventUserRemoval) &&
|
if (usersToDelete.Any(u => !u.HasMasterPassword))
|
||||||
usersToDelete.Any(u => !u.HasMasterPassword))
|
|
||||||
{
|
{
|
||||||
// Removing users without an MP will put their account in an unrecoverable state.
|
// Removing users without an MP will put their account in an unrecoverable state.
|
||||||
// We allow this during normal syncs for offboarding, but overwriteExisting risks bricking every user in
|
// We allow this during normal syncs for offboarding, but overwriteExisting risks bricking every user in
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ public static class FeatureFlagKeys
|
|||||||
public const string EventBasedOrganizationIntegrations = "event-based-organization-integrations";
|
public const string EventBasedOrganizationIntegrations = "event-based-organization-integrations";
|
||||||
public const string SeparateCustomRolePermissions = "pm-19917-separate-custom-role-permissions";
|
public const string SeparateCustomRolePermissions = "pm-19917-separate-custom-role-permissions";
|
||||||
public const string CreateDefaultLocation = "pm-19467-create-default-location";
|
public const string CreateDefaultLocation = "pm-19467-create-default-location";
|
||||||
public const string DirectoryConnectorPreventUserRemoval = "pm-24592-directory-connector-prevent-user-removal";
|
|
||||||
public const string CipherRepositoryBulkResourceCreation = "pm-24951-cipher-repository-bulk-resource-creation-service";
|
public const string CipherRepositoryBulkResourceCreation = "pm-24951-cipher-repository-bulk-resource-creation-service";
|
||||||
public const string CollectionVaultRefactor = "pm-25030-resolve-ts-upgrade-errors";
|
public const string CollectionVaultRefactor = "pm-25030-resolve-ts-upgrade-errors";
|
||||||
public const string DeleteClaimedUserAccountRefactor = "pm-25094-refactor-delete-managed-organization-user-command";
|
public const string DeleteClaimedUserAccountRefactor = "pm-25094-refactor-delete-managed-organization-user-command";
|
||||||
|
|||||||
@@ -2,14 +2,11 @@
|
|||||||
using Bit.Api.AdminConsole.Public.Models.Request;
|
using Bit.Api.AdminConsole.Public.Models.Request;
|
||||||
using Bit.Api.IntegrationTest.Factories;
|
using Bit.Api.IntegrationTest.Factories;
|
||||||
using Bit.Api.IntegrationTest.Helpers;
|
using Bit.Api.IntegrationTest.Helpers;
|
||||||
using Bit.Core;
|
|
||||||
using Bit.Core.AdminConsole.Entities;
|
using Bit.Core.AdminConsole.Entities;
|
||||||
using Bit.Core.AdminConsole.Repositories;
|
using Bit.Core.AdminConsole.Repositories;
|
||||||
using Bit.Core.Billing.Enums;
|
using Bit.Core.Billing.Enums;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Repositories;
|
using Bit.Core.Repositories;
|
||||||
using Bit.Core.Services;
|
|
||||||
using NSubstitute;
|
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Bit.Api.IntegrationTest.AdminConsole.Import;
|
namespace Bit.Api.IntegrationTest.AdminConsole.Import;
|
||||||
@@ -25,12 +22,6 @@ public class ImportOrganizationUsersAndGroupsCommandTests : IClassFixture<ApiApp
|
|||||||
public ImportOrganizationUsersAndGroupsCommandTests(ApiApplicationFactory factory)
|
public ImportOrganizationUsersAndGroupsCommandTests(ApiApplicationFactory factory)
|
||||||
{
|
{
|
||||||
_factory = factory;
|
_factory = factory;
|
||||||
_factory.SubstituteService((IFeatureService featureService)
|
|
||||||
=>
|
|
||||||
{
|
|
||||||
featureService.IsEnabled(FeatureFlagKeys.DirectoryConnectorPreventUserRemoval)
|
|
||||||
.Returns(true);
|
|
||||||
});
|
|
||||||
_client = _factory.CreateClient();
|
_client = _factory.CreateClient();
|
||||||
_loginHelper = new LoginHelper(_factory, _client);
|
_loginHelper = new LoginHelper(_factory, _client);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,8 +98,6 @@ public class ImportOrganizationUsersAndGroupsCommandTests
|
|||||||
SetupOrganizationConfigForImport(sutProvider, org, existingUsers, []);
|
SetupOrganizationConfigForImport(sutProvider, org, existingUsers, []);
|
||||||
|
|
||||||
// Existing user does not have a master password
|
// Existing user does not have a master password
|
||||||
sutProvider.GetDependency<IFeatureService>().IsEnabled(FeatureFlagKeys.DirectoryConnectorPreventUserRemoval)
|
|
||||||
.Returns(true);
|
|
||||||
existingUsers.First().HasMasterPassword = false;
|
existingUsers.First().HasMasterPassword = false;
|
||||||
|
|
||||||
sutProvider.GetDependency<IOrganizationRepository>().GetByIdAsync(org.Id).Returns(org);
|
sutProvider.GetDependency<IOrganizationRepository>().GetByIdAsync(org.Id).Returns(org);
|
||||||
|
|||||||
Reference in New Issue
Block a user