1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-23 12:25:16 +01:00

remove duplicate filter checks

This commit is contained in:
Kyle Spearrin 2017-04-18 10:21:32 -04:00
parent 4da172a94b
commit c7496d2be2

View File

@ -657,9 +657,6 @@ namespace Bit.Core.Services
throw new BadRequestException("User already invited.");
}
var orgSubvaults = await _subvaultRepository.GetManyByOrganizationIdAsync(organizationId);
var filteredSubvaults = subvaults.Where(s => orgSubvaults.Any(os => os.Id == s.SubvaultId));
var orgUser = new OrganizationUser
{
OrganizationId = organizationId,
@ -673,7 +670,7 @@ namespace Bit.Core.Services
};
await _organizationUserRepository.CreateAsync(orgUser);
await SaveUserSubvaultsAsync(orgUser, filteredSubvaults, true);
await SaveUserSubvaultsAsync(orgUser, subvaults, true);
await SendInviteAsync(orgUser);
return orgUser;
@ -789,11 +786,8 @@ namespace Bit.Core.Services
throw new BadRequestException("Organization must have at least one confirmed owner.");
}
var orgSubvaults = await _subvaultRepository.GetManyByOrganizationIdAsync(user.OrganizationId);
var filteredSubvaults = subvaults.Where(s => orgSubvaults.Any(os => os.Id == s.SubvaultId));
await _organizationUserRepository.ReplaceAsync(user);
await SaveUserSubvaultsAsync(user, filteredSubvaults, false);
await SaveUserSubvaultsAsync(user, subvaults, false);
}
public async Task DeleteUserAsync(Guid organizationId, Guid organizationUserId, Guid deletingUserId)