1
0
mirror of https://github.com/bitwarden/server synced 2026-01-04 09:33:40 +00:00

support access all for collection user details

This commit is contained in:
Kyle Spearrin
2017-05-08 11:27:21 -04:00
parent 2c604d61b2
commit 9936f69481
9 changed files with 56 additions and 25 deletions

View File

@@ -1,12 +1,18 @@
CREATE VIEW [dbo].[CollectionUserCollectionDetailsView]
AS
SELECT
CU.[Id],
CU.[OrganizationUserId],
S.[Name],
S.[Id] CollectionId,
CU.[ReadOnly]
C.[Id] Id,
C.[OrganizationId],
C.[Name],
OU.[UserId],
OU.[Id] AS [OrganizationUserId],
CASE WHEN OU.[AccessAll] = 0 AND CU.[ReadOnly] = 1 THEN 1 ELSE 0 END [ReadOnly]
FROM
[dbo].[CollectionUser] CU
[dbo].[Collection] C
INNER JOIN
[dbo].[Collection] S ON S.[Id] = CU.[CollectionId]
[dbo].[OrganizationUser] OU ON C.[OrganizationId] = OU.[OrganizationId]
LEFT JOIN
[dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = C.[Id] AND CU.[OrganizationUserId] = [OU].[Id]
WHERE
OU.[AccessAll] = 1
OR CU.[Id] IS NOT NULL