mirror of
https://github.com/bitwarden/server.git
synced 2024-11-23 12:25:16 +01:00
58 lines
1.5 KiB
MySQL
58 lines
1.5 KiB
MySQL
|
IF EXISTS(SELECT * FROM sys.views WHERE [Name] = 'OrganizationUserOrganizationDetailsView')
|
||
|
BEGIN
|
||
|
DROP VIEW [dbo].[OrganizationUserOrganizationDetailsView]
|
||
|
END
|
||
|
GO
|
||
|
|
||
|
CREATE VIEW [dbo].[OrganizationUserOrganizationDetailsView]
|
||
|
AS
|
||
|
SELECT
|
||
|
OU.[UserId],
|
||
|
OU.[OrganizationId],
|
||
|
O.[Name],
|
||
|
O.[Enabled],
|
||
|
O.[PlanType],
|
||
|
O.[UsePolicies],
|
||
|
O.[UseSso],
|
||
|
O.[UseKeyConnector],
|
||
|
O.[UseGroups],
|
||
|
O.[UseDirectory],
|
||
|
O.[UseEvents],
|
||
|
O.[UseTotp],
|
||
|
O.[Use2fa],
|
||
|
O.[UseApi],
|
||
|
O.[UseResetPassword],
|
||
|
O.[SelfHost],
|
||
|
O.[UsersGetPremium],
|
||
|
O.[Seats],
|
||
|
O.[MaxCollections],
|
||
|
O.[MaxStorageGb],
|
||
|
O.[Identifier],
|
||
|
OU.[Key],
|
||
|
OU.[ResetPasswordKey],
|
||
|
O.[PublicKey],
|
||
|
O.[PrivateKey],
|
||
|
OU.[Status],
|
||
|
OU.[Type],
|
||
|
SU.[ExternalId] SsoExternalId,
|
||
|
OU.[Permissions],
|
||
|
PO.[ProviderId],
|
||
|
P.[Name] ProviderName,
|
||
|
SS.[Data] SsoConfig,
|
||
|
OS.[FriendlyName] FamilySponsorshipFriendlyName
|
||
|
FROM
|
||
|
[dbo].[OrganizationUser] OU
|
||
|
LEFT JOIN
|
||
|
[dbo].[Organization] O ON O.[Id] = OU.[OrganizationId]
|
||
|
LEFT JOIN
|
||
|
[dbo].[SsoUser] SU ON SU.[UserId] = OU.[UserId] AND SU.[OrganizationId] = OU.[OrganizationId]
|
||
|
LEFT JOIN
|
||
|
[dbo].[ProviderOrganization] PO ON PO.[OrganizationId] = O.[Id]
|
||
|
LEFT JOIN
|
||
|
[dbo].[Provider] P ON P.[Id] = PO.[ProviderId]
|
||
|
LEFT JOIN
|
||
|
[dbo].[SsoConfig] SS ON SS.[OrganizationId] = OU.[OrganizationId]
|
||
|
LEFT JOIN
|
||
|
[dbo].[OrganizationSponsorship] OS ON OS.[SponsoringOrganizationUserID] = OU.[Id]
|
||
|
GO
|