mirror of
https://github.com/bitwarden/server.git
synced 2025-05-20 19:14:32 -05:00
[SG-783] Change organization user list to pull the user's selected color and display it in the avatar (#2630)
* work: baseline for org stuff * fix: missed view as usual oops * fix: refresh using sp_refreshsqlmodule
This commit is contained in:
parent
146d5b1984
commit
7365ca0925
@ -89,6 +89,7 @@ public class OrganizationUserUserDetailsResponseModel : OrganizationUserResponse
|
|||||||
|
|
||||||
Name = organizationUser.Name;
|
Name = organizationUser.Name;
|
||||||
Email = organizationUser.Email;
|
Email = organizationUser.Email;
|
||||||
|
AvatarColor = organizationUser.AvatarColor;
|
||||||
TwoFactorEnabled = twoFactorEnabled;
|
TwoFactorEnabled = twoFactorEnabled;
|
||||||
SsoBound = !string.IsNullOrWhiteSpace(organizationUser.SsoExternalId);
|
SsoBound = !string.IsNullOrWhiteSpace(organizationUser.SsoExternalId);
|
||||||
Collections = organizationUser.Collections.Select(c => new SelectionReadOnlyResponseModel(c));
|
Collections = organizationUser.Collections.Select(c => new SelectionReadOnlyResponseModel(c));
|
||||||
@ -97,8 +98,10 @@ public class OrganizationUserUserDetailsResponseModel : OrganizationUserResponse
|
|||||||
ResetPasswordEnrolled = ResetPasswordEnrolled && !organizationUser.UsesKeyConnector;
|
ResetPasswordEnrolled = ResetPasswordEnrolled && !organizationUser.UsesKeyConnector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
public string AvatarColor { get; set; }
|
||||||
public bool TwoFactorEnabled { get; set; }
|
public bool TwoFactorEnabled { get; set; }
|
||||||
public bool SsoBound { get; set; }
|
public bool SsoBound { get; set; }
|
||||||
public IEnumerable<SelectionReadOnlyResponseModel> Collections { get; set; }
|
public IEnumerable<SelectionReadOnlyResponseModel> Collections { get; set; }
|
||||||
|
@ -12,6 +12,7 @@ public class OrganizationUserUserDetails : IExternal, ITwoFactorProvidersUser
|
|||||||
public Guid? UserId { get; set; }
|
public Guid? UserId { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
public string AvatarColor { get; set; }
|
||||||
public string TwoFactorProviders { get; set; }
|
public string TwoFactorProviders { get; set; }
|
||||||
public bool? Premium { get; set; }
|
public bool? Premium { get; set; }
|
||||||
public OrganizationUserStatusType Status { get; set; }
|
public OrganizationUserStatusType Status { get; set; }
|
||||||
|
@ -19,6 +19,7 @@ public class OrganizationUserUserDetailsViewQuery : IQuery<OrganizationUserUserD
|
|||||||
OrganizationId = x.ou.OrganizationId,
|
OrganizationId = x.ou.OrganizationId,
|
||||||
Name = x.u.Name,
|
Name = x.u.Name,
|
||||||
Email = x.u.Email ?? x.ou.Email,
|
Email = x.u.Email ?? x.ou.Email,
|
||||||
|
AvatarColor = x.u.AvatarColor,
|
||||||
TwoFactorProviders = x.u.TwoFactorProviders,
|
TwoFactorProviders = x.u.TwoFactorProviders,
|
||||||
Premium = x.u.Premium,
|
Premium = x.u.Premium,
|
||||||
Status = x.ou.Status,
|
Status = x.ou.Status,
|
||||||
|
@ -6,6 +6,7 @@ SELECT
|
|||||||
OU.[OrganizationId],
|
OU.[OrganizationId],
|
||||||
U.[Name],
|
U.[Name],
|
||||||
ISNULL(U.[Email], OU.[Email]) Email,
|
ISNULL(U.[Email], OU.[Email]) Email,
|
||||||
|
U.[AvatarColor],
|
||||||
U.[TwoFactorProviders],
|
U.[TwoFactorProviders],
|
||||||
U.[Premium],
|
U.[Premium],
|
||||||
OU.[Status],
|
OU.[Status],
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
CREATE OR ALTER VIEW [dbo].[OrganizationUserUserDetailsView]
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
OU.[Id],
|
||||||
|
OU.[UserId],
|
||||||
|
OU.[OrganizationId],
|
||||||
|
U.[Name],
|
||||||
|
ISNULL(U.[Email], OU.[Email]) Email,
|
||||||
|
U.[AvatarColor],
|
||||||
|
U.[TwoFactorProviders],
|
||||||
|
U.[Premium],
|
||||||
|
OU.[Status],
|
||||||
|
OU.[Type],
|
||||||
|
OU.[AccessAll],
|
||||||
|
OU.[ExternalId],
|
||||||
|
SU.[ExternalId] SsoExternalId,
|
||||||
|
OU.[Permissions],
|
||||||
|
OU.[ResetPasswordKey],
|
||||||
|
U.[UsesKeyConnector]
|
||||||
|
FROM
|
||||||
|
[dbo].[OrganizationUser] OU
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[User] U ON U.[Id] = OU.[UserId]
|
||||||
|
LEFT JOIN
|
||||||
|
[dbo].[SsoUser] SU ON SU.[UserId] = OU.[UserId] AND SU.[OrganizationId] = OU.[OrganizationId]
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF OBJECT_ID('[dbo].[OrganizationUserUserDetails_ReadByOrganizationId]') IS NOT NULL
|
||||||
|
BEGIN
|
||||||
|
EXECUTE sp_refreshsqlmodule N'[dbo].[OrganizationUserUserDetails_ReadByOrganizationId]';
|
||||||
|
END
|
||||||
|
GO
|
Loading…
x
Reference in New Issue
Block a user