mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
Renamed InviteUsersValidation to InviteUsersValidator
This commit is contained in:
parent
5f41d1eb23
commit
982611bd1b
@ -22,7 +22,7 @@ namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUse
|
|||||||
|
|
||||||
public class InviteOrganizationUsersCommand(IEventService eventService,
|
public class InviteOrganizationUsersCommand(IEventService eventService,
|
||||||
IOrganizationUserRepository organizationUserRepository,
|
IOrganizationUserRepository organizationUserRepository,
|
||||||
IInviteUsersValidation inviteUsersValidation,
|
IInviteUsersValidator inviteUsersValidator,
|
||||||
IPaymentService paymentService,
|
IPaymentService paymentService,
|
||||||
IOrganizationRepository organizationRepository,
|
IOrganizationRepository organizationRepository,
|
||||||
IReferenceEventService referenceEventService,
|
IReferenceEventService referenceEventService,
|
||||||
@ -98,7 +98,7 @@ public class InviteOrganizationUsersCommand(IEventService eventService,
|
|||||||
return new Failure<IEnumerable<OrganizationUser>>(NoUsersToInvite);
|
return new Failure<IEnumerable<OrganizationUser>>(NoUsersToInvite);
|
||||||
}
|
}
|
||||||
|
|
||||||
var validationResult = await inviteUsersValidation.ValidateAsync(new InviteUserOrganizationValidationRequest
|
var validationResult = await inviteUsersValidator.ValidateAsync(new InviteUserOrganizationValidationRequest
|
||||||
{
|
{
|
||||||
Invites = invitesToSend.ToArray(),
|
Invites = invitesToSend.ToArray(),
|
||||||
InviteOrganization = request.InviteOrganization,
|
InviteOrganization = request.InviteOrganization,
|
||||||
|
@ -15,13 +15,13 @@ using SecretsManagerSubscriptionUpdate = Bit.Core.AdminConsole.OrganizationFeatu
|
|||||||
|
|
||||||
namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation;
|
namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation;
|
||||||
|
|
||||||
public interface IInviteUsersValidation : IValidator<InviteUserOrganizationValidationRequest>;
|
public interface IInviteUsersValidator : IValidator<InviteUserOrganizationValidationRequest>;
|
||||||
|
|
||||||
public class InviteUsersValidation(
|
public class InviteUsersValidator(
|
||||||
IGlobalSettings globalSettings,
|
IGlobalSettings globalSettings,
|
||||||
IProviderRepository providerRepository,
|
IProviderRepository providerRepository,
|
||||||
IPaymentService paymentService,
|
IPaymentService paymentService,
|
||||||
IOrganizationRepository organizationRepository) : IInviteUsersValidation
|
IOrganizationRepository organizationRepository) : IInviteUsersValidator
|
||||||
{
|
{
|
||||||
public async Task<ValidationResult<InviteUserOrganizationValidationRequest>> ValidateAsync(InviteUserOrganizationValidationRequest request)
|
public async Task<ValidationResult<InviteUserOrganizationValidationRequest>> ValidateAsync(InviteUserOrganizationValidationRequest request)
|
||||||
{
|
{
|
||||||
|
@ -174,7 +174,7 @@ public static class OrganizationServiceCollectionExtensions
|
|||||||
services.AddScoped<IHasConfirmedOwnersExceptQuery, HasConfirmedOwnersExceptQuery>();
|
services.AddScoped<IHasConfirmedOwnersExceptQuery, HasConfirmedOwnersExceptQuery>();
|
||||||
|
|
||||||
services.AddScoped<IInviteOrganizationUsersCommand, InviteOrganizationUsersCommand>();
|
services.AddScoped<IInviteOrganizationUsersCommand, InviteOrganizationUsersCommand>();
|
||||||
services.AddScoped<IInviteUsersValidation, InviteUsersValidation>();
|
services.AddScoped<IInviteUsersValidator, InviteUsersValidator>();
|
||||||
services.AddScoped<ISendOrganizationInvitesCommand, SendOrganizationInvitesCommand>();
|
services.AddScoped<ISendOrganizationInvitesCommand, SendOrganizationInvitesCommand>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public class InviteOrganizationUserCommandTests
|
|||||||
.SelectKnownEmailsAsync(organization.Id, Arg.Any<IEnumerable<string>>(), false)
|
.SelectKnownEmailsAsync(organization.Id, Arg.Any<IEnumerable<string>>(), false)
|
||||||
.Returns([user.Email]);
|
.Returns([user.Email]);
|
||||||
|
|
||||||
sutProvider.GetDependency<IInviteUsersValidation>()
|
sutProvider.GetDependency<IInviteUsersValidator>()
|
||||||
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
||||||
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)));
|
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)));
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ public class InviteOrganizationUserCommandTests
|
|||||||
.GetByIdAsync(organization.Id)
|
.GetByIdAsync(organization.Id)
|
||||||
.Returns(organization);
|
.Returns(organization);
|
||||||
|
|
||||||
sutProvider.GetDependency<IInviteUsersValidation>()
|
sutProvider.GetDependency<IInviteUsersValidator>()
|
||||||
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
||||||
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)));
|
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)));
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ public class InviteOrganizationUserCommandTests
|
|||||||
.GetByIdAsync(organization.Id)
|
.GetByIdAsync(organization.Id)
|
||||||
.Returns(organization);
|
.Returns(organization);
|
||||||
|
|
||||||
sutProvider.GetDependency<IInviteUsersValidation>()
|
sutProvider.GetDependency<IInviteUsersValidator>()
|
||||||
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
||||||
.Returns(new Invalid<InviteUserOrganizationValidationRequest>(new Error<InviteUserOrganizationValidationRequest>(errorMessage, new InviteUserOrganizationValidationRequest())));
|
.Returns(new Invalid<InviteUserOrganizationValidationRequest>(new Error<InviteUserOrganizationValidationRequest>(errorMessage, new InviteUserOrganizationValidationRequest())));
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ public class InviteOrganizationUserCommandTests
|
|||||||
.GetByIdAsync(organization.Id)
|
.GetByIdAsync(organization.Id)
|
||||||
.Returns(organization);
|
.Returns(organization);
|
||||||
|
|
||||||
sutProvider.GetDependency<IInviteUsersValidation>()
|
sutProvider.GetDependency<IInviteUsersValidator>()
|
||||||
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
||||||
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)
|
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)
|
||||||
.WithPasswordManagerUpdate(new PasswordManagerSubscriptionUpdate(organizationDto, organization.Seats.Value, 1))));
|
.WithPasswordManagerUpdate(new PasswordManagerSubscriptionUpdate(organizationDto, organization.Seats.Value, 1))));
|
||||||
@ -276,7 +276,7 @@ public class InviteOrganizationUserCommandTests
|
|||||||
orgRepository.GetByIdAsync(organization.Id)
|
orgRepository.GetByIdAsync(organization.Id)
|
||||||
.Returns(organization);
|
.Returns(organization);
|
||||||
|
|
||||||
sutProvider.GetDependency<IInviteUsersValidation>()
|
sutProvider.GetDependency<IInviteUsersValidator>()
|
||||||
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
||||||
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)
|
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)
|
||||||
.WithPasswordManagerUpdate(passwordManagerUpdate)));
|
.WithPasswordManagerUpdate(passwordManagerUpdate)));
|
||||||
@ -342,7 +342,7 @@ public class InviteOrganizationUserCommandTests
|
|||||||
orgRepository.GetByIdAsync(organization.Id)
|
orgRepository.GetByIdAsync(organization.Id)
|
||||||
.Returns(organization);
|
.Returns(organization);
|
||||||
|
|
||||||
sutProvider.GetDependency<IInviteUsersValidation>()
|
sutProvider.GetDependency<IInviteUsersValidator>()
|
||||||
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
.ValidateAsync(Arg.Any<InviteUserOrganizationValidationRequest>())
|
||||||
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)
|
.Returns(new Valid<InviteUserOrganizationValidationRequest>(GetInviteValidationRequestMock(request, organizationDto)
|
||||||
.WithSecretsManagerUpdate(secretsManagerSubscriptionUpdate)));
|
.WithSecretsManagerUpdate(secretsManagerSubscriptionUpdate)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user