mirror of
https://github.com/bitwarden/server.git
synced 2025-03-02 04:11:04 +01:00
Send invites for both all collection and limited collection users (#1765)
* Send invites for both all collection and limited collection users * Test all access and limited access invites * Remove comment
This commit is contained in:
parent
d694ac6052
commit
e999f66a28
@ -1191,7 +1191,7 @@ namespace Bit.Core.Services
|
||||
}
|
||||
|
||||
await AutoAddSeatsAsync(organization, newSeatsRequired, prorationDate);
|
||||
await SendInvitesAsync(orgUsers, organization);
|
||||
await SendInvitesAsync(orgUsers.Concat(limitedCollectionOrgUsers.Select(u => u.Item1)), organization);
|
||||
await _eventService.LogOrganizationUserEventsAsync(events);
|
||||
|
||||
await _referenceEventService.RaiseEventAsync(
|
||||
|
@ -334,11 +334,16 @@ namespace Bit.Core.Test.Services
|
||||
inviteeUserType: (int)OrganizationUserType.User,
|
||||
invitorUserType: (int)OrganizationUserType.Custom
|
||||
)]
|
||||
public async Task InviteUser_Passes(Organization organization, OrganizationUserInvite invite,
|
||||
public async Task InviteUser_Passes(Organization organization, IEnumerable<(OrganizationUserInvite invite, string externalId)> invites,
|
||||
OrganizationUser invitor,
|
||||
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)]OrganizationUser owner,
|
||||
SutProvider<OrganizationService> sutProvider)
|
||||
{
|
||||
// Autofixture will add collections for all of the invites, remove the first and for all the rest set all access false
|
||||
invites.First().invite.AccessAll = true;
|
||||
invites.First().invite.Collections = null;
|
||||
invites.Skip(1).ToList().ForEach(i => i.invite.AccessAll = false);
|
||||
|
||||
invitor.Permissions = JsonSerializer.Serialize(new Permissions() { ManageUsers = true },
|
||||
new JsonSerializerOptions
|
||||
{
|
||||
@ -354,7 +359,11 @@ namespace Bit.Core.Test.Services
|
||||
.Returns(new [] {owner});
|
||||
currentContext.ManageUsers(organization.Id).Returns(true);
|
||||
|
||||
await sutProvider.Sut.InviteUsersAsync(organization.Id, invitor.UserId, new (OrganizationUserInvite, string)[] { (invite, null) });
|
||||
await sutProvider.Sut.InviteUsersAsync(organization.Id, invitor.UserId, invites);
|
||||
|
||||
await sutProvider.GetDependency<IMailService>().Received(1)
|
||||
.BulkSendOrganizationInviteEmailAsync(organization.Name, Arg.Any<bool>(),
|
||||
Arg.Is<IEnumerable<(OrganizationUser, ExpiringToken)>>(v => v.Count() == invites.SelectMany(i => i.invite.Emails).Count()));
|
||||
}
|
||||
|
||||
[Theory, CustomAutoData(typeof(SutProviderCustomization))]
|
||||
|
Loading…
Reference in New Issue
Block a user