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

return collection readonly details

This commit is contained in:
Kyle Spearrin
2018-06-11 14:25:53 -04:00
parent 9cf036227e
commit 74874a1c38
10 changed files with 108 additions and 27 deletions

View File

@@ -11,6 +11,7 @@ using Bit.Core.Exceptions;
using System.Linq;
using Bit.Core.Models.Table;
using System.Collections.Generic;
using Bit.Core.Models.Data;
namespace Bit.Api.Controllers
{
@@ -59,11 +60,11 @@ namespace Bit.Api.Controllers
var folders = await _folderRepository.GetManyByUserIdAsync(user.Id);
var ciphers = await _cipherRepository.GetManyByUserIdAsync(user.Id, hasEnabledOrgs);
IEnumerable<Collection> collections = null;
IEnumerable<CollectionDetails> collections = null;
IDictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphersGroupDict = null;
if(hasEnabledOrgs)
{
collections = await _collectionRepository.GetManyByUserIdAsync(user.Id, false);
collections = await _collectionRepository.GetManyByUserIdAsync(user.Id);
var collectionCiphers = await _collectionCipherRepository.GetManyByUserIdAsync(user.Id);
collectionCiphersGroupDict = collectionCiphers.GroupBy(c => c.CipherId).ToDictionary(s => s.Key);
}