1
0
mirror of https://github.com/bitwarden/server synced 2026-01-09 12:03:21 +00:00

collection user refactor

This commit is contained in:
Kyle Spearrin
2017-05-11 14:52:35 -04:00
parent d7f9977382
commit 21d1cd6adc
43 changed files with 318 additions and 504 deletions

View File

@@ -1,28 +0,0 @@
CREATE VIEW [dbo].[CollectionUserUserDetailsView]
AS
SELECT
OU.[Id] AS [OrganizationUserId],
OU.[OrganizationId],
OU.[AccessAll],
CU.[Id],
CU.[CollectionId],
U.[Name],
ISNULL(U.[Email], OU.[Email]) Email,
OU.[Status],
OU.[Type],
CASE
WHEN OU.[AccessAll] = 0 AND CU.[ReadOnly] = 1 AND G.[AccessAll] = 0 AND CG.[ReadOnly] = 1 THEN 1
ELSE 0
END [ReadOnly]
FROM
[dbo].[OrganizationUser] OU
LEFT JOIN
[dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[OrganizationUserId] = OU.[Id]
LEFT JOIN
[dbo].[User] U ON U.[Id] = OU.[UserId]
LEFT JOIN
[dbo].[GroupUser] GU ON CU.[CollectionId] IS NULL AND OU.[AccessAll] = 0 AND GU.[OrganizationUserId] = OU.[Id]
LEFT JOIN
[dbo].[Group] G ON G.[Id] = GU.[GroupId]
LEFT JOIN
[dbo].[CollectionGroup] CG ON G.[AccessAll] = 0 AND CG.[GroupId] = GU.[GroupId]

View File

@@ -1,6 +0,0 @@
CREATE VIEW [dbo].[CollectionUserView]
AS
SELECT
*
FROM
[dbo].[CollectionUser]

View File

@@ -1,17 +0,0 @@
CREATE VIEW [dbo].[GroupUserUserDetailsView]
AS
SELECT
OU.[Id] AS [OrganizationUserId],
OU.[OrganizationId],
OU.[AccessAll],
GU.[GroupId],
U.[Name],
ISNULL(U.[Email], OU.[Email]) Email,
OU.[Status],
OU.[Type]
FROM
[dbo].[OrganizationUser] OU
INNER JOIN
[dbo].[GroupUser] GU ON GU.[OrganizationUserId] = OU.[Id]
INNER JOIN
[dbo].[User] U ON U.[Id] = OU.[UserId]