1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-26 12:55:17 +01:00

only return collections for confirmed users

This commit is contained in:
Kyle Spearrin 2017-05-15 21:39:28 -04:00
parent 6958a3fda5
commit 564b8194c1

View File

@ -10,6 +10,8 @@ BEGIN
[dbo].[CollectionView] C [dbo].[CollectionView] C
INNER JOIN INNER JOIN
[dbo].[OrganizationUser] OU ON C.[OrganizationId] = OU.[OrganizationId] [dbo].[OrganizationUser] OU ON C.[OrganizationId] = OU.[OrganizationId]
INNER JOIN
[dbo].[Organization] O ON C.[OrganizationId] = O.[Id]
LEFT JOIN LEFT JOIN
[dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = C.[Id] AND CU.[OrganizationUserId] = [OU].[Id] [dbo].[CollectionUser] CU ON OU.[AccessAll] = 0 AND CU.[CollectionId] = C.[Id] AND CU.[OrganizationUserId] = [OU].[Id]
LEFT JOIN LEFT JOIN
@ -20,6 +22,8 @@ BEGIN
[dbo].[CollectionGroup] CG ON G.[AccessAll] = 0 AND CG.[CollectionId] = C.[Id] AND CG.[GroupId] = GU.[GroupId] [dbo].[CollectionGroup] CG ON G.[AccessAll] = 0 AND CG.[CollectionId] = C.[Id] AND CG.[GroupId] = GU.[GroupId]
WHERE WHERE
OU.[UserId] = @UserId OU.[UserId] = @UserId
AND OU.[Status] = 2 -- 2 = Confirmed
AND O.[Enabled] = 1
AND ( AND (
OU.[AccessAll] = 1 OU.[AccessAll] = 1
OR CU.[CollectionId] IS NOT NULL OR CU.[CollectionId] IS NOT NULL