mirror of
https://github.com/bitwarden/server.git
synced 2025-05-05 11:42:22 -05:00
[PM-15621] Fix merge conflicts
This commit is contained in:
parent
3ec56feb3a
commit
c89feec953
@ -1,5 +1,6 @@
|
||||
using Bit.Core.AdminConsole.Errors;
|
||||
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.Interfaces;
|
||||
using Bit.Core.AdminConsole.Repositories;
|
||||
using Bit.Core.AdminConsole.Shared.Validation;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
@ -23,16 +24,14 @@ public class DeleteClaimedOrganizationUserAccountCommand : IDeleteClaimedOrganiz
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private readonly IEventService _eventService;
|
||||
private readonly IDeleteManagedOrganizationUserAccountValidator _deleteManagedOrganizationUserAccountValidator;
|
||||
private readonly IGetOrganizationUsersManagementStatusQuery _getOrganizationUsersManagementStatusQuery;
|
||||
private readonly IGetOrganizationUsersClaimedStatusQuery _getOrganizationUsersClaimedStatusQuery;
|
||||
private readonly IDeleteClaimedOrganizationUserAccountValidator _deleteManagedOrganizationUserAccountValidator;
|
||||
private readonly ILogger<DeleteClaimedOrganizationUserAccountCommand> _logger;
|
||||
private readonly IOrganizationUserRepository _organizationUserRepository;
|
||||
private readonly IUserRepository _userRepository;
|
||||
private readonly ICurrentContext _currentContext;
|
||||
private readonly ILogger<DeleteClaimedOrganizationUserAccountCommand> _logger;
|
||||
private readonly IReferenceEventService _referenceEventService;
|
||||
private readonly IPushNotificationService _pushService;
|
||||
private readonly IOrganizationRepository _organizationRepository;
|
||||
private readonly IProviderUserRepository _providerUserRepository;
|
||||
public DeleteClaimedOrganizationUserAccountCommand(
|
||||
IUserService userService,
|
||||
@ -41,21 +40,23 @@ public class DeleteClaimedOrganizationUserAccountCommand : IDeleteClaimedOrganiz
|
||||
IOrganizationUserRepository organizationUserRepository,
|
||||
IUserRepository userRepository,
|
||||
ICurrentContext currentContext,
|
||||
ILogger<DeleteClaimedOrganizationUserAccountCommand> logger,
|
||||
IReferenceEventService referenceEventService,
|
||||
IPushNotificationService pushService)
|
||||
IPushNotificationService pushService,
|
||||
IProviderUserRepository providerUserRepository,
|
||||
ILogger<DeleteClaimedOrganizationUserAccountCommand> logger,
|
||||
IDeleteClaimedOrganizationUserAccountValidator deleteManagedOrganizationUserAccountValidator)
|
||||
{
|
||||
_userService = userService;
|
||||
_eventService = eventService;
|
||||
_deleteManagedOrganizationUserAccountValidator = deleteManagedOrganizationUserAccountValidator;
|
||||
_getOrganizationUsersManagementStatusQuery = _getOrganizationUsersManagementStatusQuery;
|
||||
_getOrganizationUsersClaimedStatusQuery = getOrganizationUsersClaimedStatusQuery;
|
||||
_organizationUserRepository = organizationUserRepository;
|
||||
_userRepository = userRepository;
|
||||
_currentContext = currentContext;
|
||||
_logger = logger;
|
||||
_referenceEventService = referenceEventService;
|
||||
_pushService = pushService;
|
||||
_providerUserRepository = providerUserRepository;
|
||||
_logger = logger;
|
||||
_deleteManagedOrganizationUserAccountValidator = deleteManagedOrganizationUserAccountValidator;
|
||||
}
|
||||
|
||||
public async Task<CommandResult<DeleteUserResponse>> DeleteUserAsync(Guid organizationId, Guid organizationUserId, Guid deletingUserId)
|
||||
@ -93,7 +94,7 @@ public class DeleteClaimedOrganizationUserAccountCommand : IDeleteClaimedOrganiz
|
||||
{
|
||||
var orgUsers = await _organizationUserRepository.GetManyAsync(orgUserIds);
|
||||
var users = await GetUsersAsync(orgUsers);
|
||||
var managementStatuses = await _getOrganizationUsersManagementStatusQuery.GetUsersOrganizationManagementStatusAsync(organizationId, orgUserIds);
|
||||
var managementStatuses = await _getOrganizationUsersClaimedStatusQuery.GetUsersOrganizationClaimedStatusAsync(organizationId, orgUserIds);
|
||||
|
||||
var requests = CreateRequests(organizationId, deletingUserId, orgUserIds, orgUsers, users, managementStatuses);
|
||||
var results = await _deleteManagedOrganizationUserAccountValidator.ValidateAsync(requests);
|
||||
|
@ -8,10 +8,10 @@ using Bit.Core.Repositories;
|
||||
|
||||
namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers;
|
||||
|
||||
public class DeleteManagedOrganizationUserAccountValidator(
|
||||
public class DeleteClaimedOrganizationUserAccountValidator(
|
||||
ICurrentContext currentContext,
|
||||
IOrganizationUserRepository organizationUserRepository,
|
||||
IProviderUserRepository providerUserRepository) : IDeleteManagedOrganizationUserAccountValidator
|
||||
IProviderUserRepository providerUserRepository) : IDeleteClaimedOrganizationUserAccountValidator
|
||||
{
|
||||
public async Task<PartialValidationResult<DeleteUserValidationRequest>> ValidateAsync(List<DeleteUserValidationRequest> requests)
|
||||
{
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.Interfaces;
|
||||
|
||||
public interface IDeleteManagedOrganizationUserAccountValidator
|
||||
public interface IDeleteClaimedOrganizationUserAccountValidator
|
||||
{
|
||||
Task<PartialValidationResult<DeleteUserValidationRequest>> ValidateAsync(List<DeleteUserValidationRequest> requests);
|
||||
}
|
@ -128,7 +128,7 @@ public static class OrganizationServiceCollectionExtensions
|
||||
services.AddScoped<IUpdateOrganizationUserCommand, UpdateOrganizationUserCommand>();
|
||||
services.AddScoped<IUpdateOrganizationUserGroupsCommand, UpdateOrganizationUserGroupsCommand>();
|
||||
services.AddScoped<IDeleteClaimedOrganizationUserAccountCommand, DeleteClaimedOrganizationUserAccountCommand>();
|
||||
services.AddScoped<IDeleteManagedOrganizationUserAccountValidator, DeleteManagedOrganizationUserAccountValidator>();
|
||||
services.AddScoped<IDeleteClaimedOrganizationUserAccountValidator, DeleteClaimedOrganizationUserAccountValidator>();
|
||||
services.AddScoped<IConfirmOrganizationUserCommand, ConfirmOrganizationUserCommand>();
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,6 @@ public class OrganizationUsersControllerTests
|
||||
sutProvider.Sut.DeleteAccount(orgId, id));
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// [Theory]
|
||||
// [BitAutoData]
|
||||
// public async Task BulkDeleteAccount_WhenUserCanManageUsers_Success(
|
||||
@ -369,7 +368,7 @@ public class OrganizationUsersControllerTests
|
||||
// {
|
||||
// sutProvider.GetDependency<ICurrentContext>().ManageUsers(orgId).Returns(true);
|
||||
// sutProvider.GetDependency<IUserService>().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(currentUser);
|
||||
// sutProvider.GetDependency<IDeleteManagedOrganizationUserAccountCommand>()
|
||||
// sutProvider.GetDependency<IDeleteClaimedOrganizationUserAccountCommand>()
|
||||
// .DeleteManyUsersAsync(orgId, model.Ids, currentUser.Id)
|
||||
// .Returns(deleteResults);
|
||||
//
|
||||
@ -377,32 +376,10 @@ public class OrganizationUsersControllerTests
|
||||
//
|
||||
// Assert.Equal(deleteResults.Count, response.Data.Count());
|
||||
// Assert.True(response.Data.All(r => deleteResults.Any(res => res.Item1 == r.Id && res.Item2 == r.Error)));
|
||||
// await sutProvider.GetDependency<IDeleteManagedOrganizationUserAccountCommand>()
|
||||
// await sutProvider.GetDependency<IDeleteClaimedOrganizationUserAccountCommand>()
|
||||
// .Received(1)
|
||||
// .DeleteManyUsersAsync(orgId, model.Ids, currentUser.Id);
|
||||
// }
|
||||
=======
|
||||
[Theory]
|
||||
[BitAutoData]
|
||||
public async Task BulkDeleteAccount_WhenUserCanManageUsers_Success(
|
||||
Guid orgId, OrganizationUserBulkRequestModel model, User currentUser,
|
||||
List<(Guid, string)> deleteResults, SutProvider<OrganizationUsersController> sutProvider)
|
||||
{
|
||||
sutProvider.GetDependency<ICurrentContext>().ManageUsers(orgId).Returns(true);
|
||||
sutProvider.GetDependency<IUserService>().GetUserByPrincipalAsync(default).ReturnsForAnyArgs(currentUser);
|
||||
sutProvider.GetDependency<IDeleteClaimedOrganizationUserAccountCommand>()
|
||||
.DeleteManyUsersAsync(orgId, model.Ids, currentUser.Id)
|
||||
.Returns(deleteResults);
|
||||
|
||||
var response = await sutProvider.Sut.BulkDeleteAccount(orgId, model);
|
||||
|
||||
Assert.Equal(deleteResults.Count, response.Data.Count());
|
||||
Assert.True(response.Data.All(r => deleteResults.Any(res => res.Item1 == r.Id && res.Item2 == r.Error)));
|
||||
await sutProvider.GetDependency<IDeleteClaimedOrganizationUserAccountCommand>()
|
||||
.Received(1)
|
||||
.DeleteManyUsersAsync(orgId, model.Ids, currentUser.Id);
|
||||
}
|
||||
>>>>>>> main
|
||||
|
||||
[Theory]
|
||||
[BitAutoData]
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user