mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
fix: sync ef query with view by joining also on UserId and making the expiration time check inclusive.
This commit is contained in:
@ -72,11 +72,12 @@ public class AuthRequestRepository : Repository<Core.Auth.Entities.AuthRequest,
|
|||||||
where authRequest.Type == AuthRequestType.AuthenticateAndUnlock
|
where authRequest.Type == AuthRequestType.AuthenticateAndUnlock
|
||||||
|| authRequest.Type == AuthRequestType.Unlock
|
|| authRequest.Type == AuthRequestType.Unlock
|
||||||
where authRequest.UserId == userId
|
where authRequest.UserId == userId
|
||||||
where authRequest.CreationDate.AddMinutes(expirationMinutes) > DateTime.UtcNow
|
where authRequest.CreationDate.AddMinutes(expirationMinutes) >= DateTime.UtcNow
|
||||||
group authRequest by authRequest.RequestDeviceIdentifier into groupedAuthRequests
|
group authRequest by authRequest.RequestDeviceIdentifier into groupedAuthRequests
|
||||||
select
|
select
|
||||||
(from r in groupedAuthRequests
|
(from r in groupedAuthRequests
|
||||||
join d in dbContext.Devices on r.RequestDeviceIdentifier equals d.Identifier into deviceJoin
|
join d in dbContext.Devices on new { r.RequestDeviceIdentifier, r.UserId }
|
||||||
|
equals new { RequestDeviceIdentifier = d.Identifier, d.UserId } into deviceJoin
|
||||||
from dj in deviceJoin.DefaultIfEmpty() // This creates a left join allowing null for devices
|
from dj in deviceJoin.DefaultIfEmpty() // This creates a left join allowing null for devices
|
||||||
orderby r.CreationDate descending
|
orderby r.CreationDate descending
|
||||||
select new PendingAuthRequestDetails(r, dj.Id)).First()
|
select new PendingAuthRequestDetails(r, dj.Id)).First()
|
||||||
|
Reference in New Issue
Block a user