mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 21:18:13 -05:00
[SG-927] Pull the user's selected avatar color from the state store and display on Emergency Contacts page (#2582)
* work: backend changes * fix: lets not mix up Grantor and Grantee * work: update view
This commit is contained in:
parent
7b4c9b0e59
commit
862ce01bf4
@ -54,11 +54,13 @@ public class EmergencyAccessGranteeDetailsResponseModel : EmergencyAccessRespons
|
|||||||
GranteeId = emergencyAccess.GranteeId.ToString();
|
GranteeId = emergencyAccess.GranteeId.ToString();
|
||||||
Email = emergencyAccess.GranteeEmail;
|
Email = emergencyAccess.GranteeEmail;
|
||||||
Name = emergencyAccess.GranteeName;
|
Name = emergencyAccess.GranteeName;
|
||||||
|
AvatarColor = emergencyAccess.GranteeAvatarColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GranteeId { get; private set; }
|
public string GranteeId { get; private set; }
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
public string Email { get; private set; }
|
public string Email { get; private set; }
|
||||||
|
public string AvatarColor { get; private set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EmergencyAccessGrantorDetailsResponseModel : EmergencyAccessResponseModel
|
public class EmergencyAccessGrantorDetailsResponseModel : EmergencyAccessResponseModel
|
||||||
@ -74,11 +76,13 @@ public class EmergencyAccessGrantorDetailsResponseModel : EmergencyAccessRespons
|
|||||||
GrantorId = emergencyAccess.GrantorId.ToString();
|
GrantorId = emergencyAccess.GrantorId.ToString();
|
||||||
Email = emergencyAccess.GrantorEmail;
|
Email = emergencyAccess.GrantorEmail;
|
||||||
Name = emergencyAccess.GrantorName;
|
Name = emergencyAccess.GrantorName;
|
||||||
|
AvatarColor = emergencyAccess.GrantorAvatarColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GrantorId { get; private set; }
|
public string GrantorId { get; private set; }
|
||||||
public string Name { get; private set; }
|
public string Name { get; private set; }
|
||||||
public string Email { get; private set; }
|
public string Email { get; private set; }
|
||||||
|
public string AvatarColor { get; private set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EmergencyAccessTakeoverResponseModel : ResponseModel
|
public class EmergencyAccessTakeoverResponseModel : ResponseModel
|
||||||
|
@ -6,6 +6,8 @@ public class EmergencyAccessDetails : EmergencyAccess
|
|||||||
{
|
{
|
||||||
public string GranteeName { get; set; }
|
public string GranteeName { get; set; }
|
||||||
public string GranteeEmail { get; set; }
|
public string GranteeEmail { get; set; }
|
||||||
|
public string GranteeAvatarColor { get; set; }
|
||||||
public string GrantorName { get; set; }
|
public string GrantorName { get; set; }
|
||||||
public string GrantorEmail { get; set; }
|
public string GrantorEmail { get; set; }
|
||||||
|
public string GrantorAvatarColor { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,10 @@ SELECT
|
|||||||
EA.*,
|
EA.*,
|
||||||
GranteeU.[Name] GranteeName,
|
GranteeU.[Name] GranteeName,
|
||||||
ISNULL(GranteeU.[Email], EA.[Email]) GranteeEmail,
|
ISNULL(GranteeU.[Email], EA.[Email]) GranteeEmail,
|
||||||
|
GranteeU.[AvatarColor] GranteeAvatarColor,
|
||||||
GrantorU.[Name] GrantorName,
|
GrantorU.[Name] GrantorName,
|
||||||
GrantorU.[Email] GrantorEmail
|
GrantorU.[Email] GrantorEmail,
|
||||||
|
GrantorU.[AvatarColor] GrantorAvatarColor
|
||||||
FROM
|
FROM
|
||||||
[dbo].[EmergencyAccess] EA
|
[dbo].[EmergencyAccess] EA
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
SET ANSI_NULLS ON
|
||||||
|
GO
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE OR ALTER VIEW [dbo].[EmergencyAccessDetailsView]
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
EA.*,
|
||||||
|
GranteeU.[Name] GranteeName,
|
||||||
|
ISNULL(GranteeU.[Email], EA.[Email]) GranteeEmail,
|
||||||
|
GranteeU.[AvatarColor] GranteeAvatarColor,
|
||||||
|
GrantorU.[Name] GrantorName,
|
||||||
|
GrantorU.[Email] GrantorEmail,
|
||||||
|
GrantorU.[AvatarColor] GrantorAvatarColor
|
||||||
|
FROM
|
||||||
|
[dbo].[EmergencyAccess] EA
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[User] GranteeU ON GranteeU.[Id] = EA.[GranteeId]
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[User] GrantorU ON GrantorU.[Id] = EA.[GrantorId]
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE OR ALTER PROCEDURE [dbo].[EmergencyAccessDetails_ReadByGrantorId]
|
||||||
|
@GrantorId UNIQUEIDENTIFIER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
[dbo].[EmergencyAccessDetailsView]
|
||||||
|
WHERE
|
||||||
|
[GrantorId] = @GrantorId
|
||||||
|
END
|
||||||
|
GO
|
Loading…
x
Reference in New Issue
Block a user