mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
limit AvailableSubvaultsCTE by org id of cipher
This commit is contained in:
parent
0e2e39e747
commit
89efb07eed
@ -36,8 +36,9 @@ BEGIN
|
|||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
[dbo].[SubvaultUser] SU ON OU.[AccessAllSubvaults] = 0 AND SU.[SubvaultId] = S.[Id] AND SU.[OrganizationUserId] = OU.[Id]
|
[dbo].[SubvaultUser] SU ON OU.[AccessAllSubvaults] = 0 AND SU.[SubvaultId] = S.[Id] AND SU.[OrganizationUserId] = OU.[Id]
|
||||||
WHERE
|
WHERE
|
||||||
OU.[Status] = 2 -- Confirmed
|
O.[Id] = @OrganizationId
|
||||||
AND O.[Enabled] = 1
|
AND O.[Enabled] = 1
|
||||||
|
AND OU.[Status] = 2 -- Confirmed
|
||||||
AND (OU.[AccessAllSubvaults] = 1 OR SU.[ReadOnly] = 0)
|
AND (OU.[AccessAllSubvaults] = 1 OR SU.[ReadOnly] = 0)
|
||||||
)
|
)
|
||||||
INSERT INTO [dbo].[SubvaultCipher]
|
INSERT INTO [dbo].[SubvaultCipher]
|
||||||
|
@ -6,6 +6,15 @@ AS
|
|||||||
BEGIN
|
BEGIN
|
||||||
SET NOCOUNT ON
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
DECLARE @OrgId UNIQUEIDENTIFIER = (
|
||||||
|
SELECT TOP 1
|
||||||
|
[OrganizationId]
|
||||||
|
FROM
|
||||||
|
[dbo].[Cipher]
|
||||||
|
WHERE
|
||||||
|
[Id] = @CipherId
|
||||||
|
)
|
||||||
|
|
||||||
;WITH [AvailableSubvaultsCTE] AS(
|
;WITH [AvailableSubvaultsCTE] AS(
|
||||||
SELECT
|
SELECT
|
||||||
S.[Id]
|
S.[Id]
|
||||||
@ -18,8 +27,9 @@ BEGIN
|
|||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
[dbo].[SubvaultUser] SU ON OU.[AccessAllSubvaults] = 0 AND SU.[SubvaultId] = S.[Id] AND SU.[OrganizationUserId] = OU.[Id]
|
[dbo].[SubvaultUser] SU ON OU.[AccessAllSubvaults] = 0 AND SU.[SubvaultId] = S.[Id] AND SU.[OrganizationUserId] = OU.[Id]
|
||||||
WHERE
|
WHERE
|
||||||
OU.[Status] = 2 -- Confirmed
|
O.[Id] = @OrgId
|
||||||
AND O.[Enabled] = 1
|
AND O.[Enabled] = 1
|
||||||
|
AND OU.[Status] = 2 -- Confirmed
|
||||||
AND (OU.[AccessAllSubvaults] = 1 OR SU.[ReadOnly] = 0)
|
AND (OU.[AccessAllSubvaults] = 1 OR SU.[ReadOnly] = 0)
|
||||||
)
|
)
|
||||||
MERGE
|
MERGE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user