1
0
mirror of https://github.com/bitwarden/server synced 2025-12-19 09:43:25 +00:00

refactor cipher queries by user. tuned indexing.

This commit is contained in:
Kyle Spearrin
2018-04-24 12:48:43 -04:00
parent ac4f789782
commit 165ee97d2f
16 changed files with 321 additions and 175 deletions

View File

@@ -55,12 +55,13 @@ namespace Bit.Api.Controllers
var organizationUserDetails = await _organizationUserRepository.GetManyDetailsByUserAsync(user.Id,
OrganizationUserStatusType.Confirmed);
var hasEnabledOrgs = organizationUserDetails.Any(o => o.Enabled);
var folders = await _folderRepository.GetManyByUserIdAsync(user.Id);
var ciphers = await _cipherRepository.GetManyByUserIdAsync(user.Id);
var ciphers = await _cipherRepository.GetManyByUserIdAsync(user.Id, hasEnabledOrgs);
IEnumerable<Collection> collections = null;
IDictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphersGroupDict = null;
if(organizationUserDetails.Any(o => o.Enabled))
if(hasEnabledOrgs)
{
collections = await _collectionRepository.GetManyByUserIdAsync(user.Id, false);
var collectionCiphers = await _collectionCipherRepository.GetManyByUserIdAsync(user.Id);