1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-06 21:48:12 -05:00

use withOrganizations sproc

This commit is contained in:
Kyle Spearrin 2018-04-24 20:19:23 -04:00
parent 165ee97d2f
commit 528a0732a6
2 changed files with 3 additions and 4 deletions

View File

@ -90,7 +90,8 @@ namespace Bit.Api.Controllers
{ {
var userId = _userService.GetProperUserId(User).Value; var userId = _userService.GetProperUserId(User).Value;
var hasOrgs = _currentContext.Organizations.Any(); var hasOrgs = _currentContext.Organizations.Any();
var ciphers = await _cipherRepository.GetManyByUserIdAsync(userId, hasOrgs); // TODO: Use hasOrgs proper for cipher listing here?
var ciphers = await _cipherRepository.GetManyByUserIdAsync(userId, true || hasOrgs);
Dictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphersGroupDict = null; Dictionary<Guid, IGrouping<Guid, CollectionCipher>> collectionCiphersGroupDict = null;
if(hasOrgs) if(hasOrgs)
{ {

View File

@ -65,9 +65,7 @@ namespace Bit.Core.Repositories.SqlServer
public async Task<ICollection<CipherDetails>> GetManyByUserIdAsync(Guid userId, bool withOrganizations = true) public async Task<ICollection<CipherDetails>> GetManyByUserIdAsync(Guid userId, bool withOrganizations = true)
{ {
string sprocName = null; string sprocName = null;
// Always "with organizations" for now. Future TODO is to possibly move to another, simpler sproc when no if(withOrganizations)
// orgs are expected.
if(true || withOrganizations)
{ {
sprocName = $"[{Schema}].[CipherDetails_ReadByUserId]"; sprocName = $"[{Schema}].[CipherDetails_ReadByUserId]";
} }