Skip to content

Commit

Permalink
fix(authentication): fix queries causing forbidden for newly register…
Browse files Browse the repository at this point in the history
…ed users (#386)
  • Loading branch information
ntruchsess authored Dec 19, 2023
1 parent fb5b9a3 commit 2d99938
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ public IdentityRepository(PortalDbContext context)
{
_context = context;
}

public Task<Guid> GetActiveCompanyIdByIdentityId(Guid identityId) =>
_context.Identities.Where(x => x.Id == identityId && x.UserEntityId != null && x.UserStatusId == UserStatusId.ACTIVE)
_context.Identities.Where(x => x.Id == identityId && x.UserStatusId == UserStatusId.ACTIVE)
.Select(x => x.CompanyId)
.SingleOrDefaultAsync();

public Task<(IdentityTypeId IdentityTypeId, Guid CompanyId)> GetActiveIdentityDataByIdentityId(Guid identityId) =>
_context.Identities.Where(x => x.Id == identityId && x.UserEntityId != null && x.UserStatusId == UserStatusId.ACTIVE)
_context.Identities.Where(x => x.Id == identityId && x.UserStatusId == UserStatusId.ACTIVE)
.Select(x => new ValueTuple<IdentityTypeId, Guid>(
x.IdentityTypeId,
x.CompanyId))
Expand Down

0 comments on commit 2d99938

Please sign in to comment.