mirror of
https://github.com/bitwarden/server.git
synced 2025-06-25 21:28:47 -05:00
fix: rename parameter to be clearer and changed order of parameters in constructor.
This commit is contained in:
parent
be3ccc3ff0
commit
943b0024bb
@ -8,8 +8,8 @@ public class PendingAuthRequestResponseModel : AuthRequestResponseModel
|
|||||||
: base(authRequest, vaultUri, obj)
|
: base(authRequest, vaultUri, obj)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(authRequest);
|
ArgumentNullException.ThrowIfNull(authRequest);
|
||||||
RequestingDeviceId = authRequest.DeviceId;
|
RequestDeviceId = authRequest.RequestDeviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid? RequestingDeviceId { get; set; }
|
public Guid? RequestDeviceId { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ namespace Bit.Core.Auth.Models.Data;
|
|||||||
|
|
||||||
public class PendingAuthRequestDetails : AuthRequest
|
public class PendingAuthRequestDetails : AuthRequest
|
||||||
{
|
{
|
||||||
public Guid? DeviceId { get; set; }
|
public Guid? RequestDeviceId { get; set; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for EF response.
|
* Constructor for EF response.
|
||||||
@ -35,16 +35,17 @@ public class PendingAuthRequestDetails : AuthRequest
|
|||||||
CreationDate = authRequest.CreationDate;
|
CreationDate = authRequest.CreationDate;
|
||||||
ResponseDate = authRequest.ResponseDate;
|
ResponseDate = authRequest.ResponseDate;
|
||||||
AuthenticationDate = authRequest.AuthenticationDate;
|
AuthenticationDate = authRequest.AuthenticationDate;
|
||||||
DeviceId = deviceId;
|
RequestDeviceId = deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for dapper response.
|
* Constructor for dapper response.
|
||||||
* Note: if the DeviceId is null it comes back as an empty guid That could change if the stored
|
* Note: if the DeviceId is null it comes back as an empty guid That could change if the stored
|
||||||
* procedure runs on a different kind of db.
|
* procedure runs on a different database provider.
|
||||||
* In order to maintain the flexibility of the wildcard * in SQL the constrctor accepts a long "row number rn"
|
* In order to maintain the flexibility of the wildcard (*) in SQL, the constructor accepts a"row number" rn of type long
|
||||||
* parameter that was used to order the results in the SQL query. Also SQL complains about the constructor not
|
* parameter. 'rn' was used to order the results in the SQL query. Also, SQL complains about the constructor not
|
||||||
* having the same parameters as the SELECT statement.
|
* having the same parameters as the SELECT statement and since the SELECT uses the wildcard we need to include everything.
|
||||||
|
* Order matters when mapping from the Stored Procedure, so the columns are in the order they come back from the query.
|
||||||
*/
|
*/
|
||||||
public PendingAuthRequestDetails(
|
public PendingAuthRequestDetails(
|
||||||
Guid id,
|
Guid id,
|
||||||
@ -69,12 +70,10 @@ public class PendingAuthRequestDetails : AuthRequest
|
|||||||
{
|
{
|
||||||
Id = id;
|
Id = id;
|
||||||
UserId = userId;
|
UserId = userId;
|
||||||
OrganizationId = organizationId;
|
|
||||||
Type = (AuthRequestType)type;
|
Type = (AuthRequestType)type;
|
||||||
RequestDeviceIdentifier = requestDeviceIdentifier;
|
RequestDeviceIdentifier = requestDeviceIdentifier;
|
||||||
RequestDeviceType = (DeviceType)requestDeviceType;
|
RequestDeviceType = (DeviceType)requestDeviceType;
|
||||||
RequestIpAddress = requestIpAddress;
|
RequestIpAddress = requestIpAddress;
|
||||||
RequestCountryName = requestCountryName;
|
|
||||||
ResponseDeviceId = responseDeviceId;
|
ResponseDeviceId = responseDeviceId;
|
||||||
AccessCode = accessCode;
|
AccessCode = accessCode;
|
||||||
PublicKey = publicKey;
|
PublicKey = publicKey;
|
||||||
@ -84,6 +83,8 @@ public class PendingAuthRequestDetails : AuthRequest
|
|||||||
CreationDate = creationDate;
|
CreationDate = creationDate;
|
||||||
ResponseDate = responseDate;
|
ResponseDate = responseDate;
|
||||||
AuthenticationDate = authenticationDate;
|
AuthenticationDate = authenticationDate;
|
||||||
DeviceId = deviceId;
|
OrganizationId = organizationId;
|
||||||
|
RequestCountryName = requestCountryName;
|
||||||
|
RequestDeviceId = deviceId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class AuthRequestRepository : Repository<Core.Auth.Entities.AuthRequest,
|
|||||||
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 r.RequestDeviceIdentifier equals d.Identifier into deviceJoin
|
||||||
from dj in deviceJoin.DefaultIfEmpty() // This accomplishes a left join allowing nulld 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()
|
||||||
).ToListAsync();
|
).ToListAsync();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user