1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

reference OrganizationMembership instead

This commit is contained in:
Kyle Spearrin
2018-08-31 17:05:27 -04:00
parent b2d63b2383
commit 2562d5a40d
8 changed files with 54 additions and 61 deletions

View File

@ -224,16 +224,16 @@ namespace Bit.Core.IdentityServer
Organization firstEnabledOrg = null;
var orgs = (await _currentContext.OrganizationMembershipAsync(_organizationUserRepository, user.Id))
.Where(o => o.Status == OrganizationUserStatusType.Confirmed).ToList();
.ToList();
if(orgs.Any())
{
var orgAbilities = await _applicationCacheService.GetOrganizationAbilitiesAsync();
var twoFactorOrgs = orgs.Where(o => OrgUsing2fa(orgAbilities, o.OrganizationId));
var twoFactorOrgs = orgs.Where(o => OrgUsing2fa(orgAbilities, o.Id));
if(twoFactorOrgs.Any())
{
var userOrgs = await _organizationRepository.GetManyByUserIdAsync(user.Id);
firstEnabledOrg = userOrgs.FirstOrDefault(
o => orgs.Any(om => om.OrganizationId == o.Id) && o.TwoFactorIsEnabled());
o => orgs.Any(om => om.Id == o.Id) && o.TwoFactorIsEnabled());
}
}