mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
subvault information sprocs
This commit is contained in:
parent
79ea8fef37
commit
1d3092b6b2
@ -159,5 +159,7 @@
|
||||
<Build Include="dbo\Stored Procedures\SubvaultUserDetails_ReadByUserId.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Subvault_ReadByOrganizationIdAdminUserId.sql" />
|
||||
<Build Include="dbo\Views\SubvaultUserDetailsView.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Cipher_ReadByUserIdHasSubvault.sql" />
|
||||
<Build Include="dbo\Stored Procedures\SubvaultCipher_ReadByUserId.sql" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,19 @@
|
||||
CREATE PROCEDURE [dbo].[Cipher_ReadByUserIdHasSubvault]
|
||||
@UserId UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT DISTINCT
|
||||
C.*
|
||||
FROM
|
||||
[dbo].[CipherView] C
|
||||
INNER JOIN
|
||||
[dbo].[SubvaultCipher] SC ON SC.[CipherId] = C.[Id]
|
||||
INNER JOIN
|
||||
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
||||
INNER JOIN
|
||||
[dbo].[OrganizationUser] OU ON OU.[Id] = SU.[OrganizationUserId]
|
||||
WHERE
|
||||
[OU].[UserId] = @UserId
|
||||
END
|
@ -0,0 +1,17 @@
|
||||
CREATE PROCEDURE [dbo].[SubvaultCipher_ReadByUserId]
|
||||
@UserId UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
SELECT
|
||||
SC.*
|
||||
FROM
|
||||
[dbo].[SubvaultCipher] SC
|
||||
INNER JOIN
|
||||
[dbo].[SubvaultUser] SU ON SU.[SubvaultId] = SC.[SubvaultId]
|
||||
INNER JOIN
|
||||
[dbo].[OrganizationUser] OU ON OU.[Id] = SU.[OrganizationUserId]
|
||||
WHERE
|
||||
[OU].[UserId] = @UserId
|
||||
END
|
@ -1,5 +1,4 @@
|
||||
CREATE PROCEDURE [dbo].[Subvault_ReadByIdAdminUserId]
|
||||
@Id UNIQUEIDENTIFIER,
|
||||
CREATE PROCEDURE [dbo].[Subvault_ReadByUserId]
|
||||
@UserId UNIQUEIDENTIFIER
|
||||
AS
|
||||
BEGIN
|
||||
@ -10,9 +9,9 @@ BEGIN
|
||||
FROM
|
||||
[dbo].[SubvaultView] S
|
||||
INNER JOIN
|
||||
[OrganizationUser] OU ON OU.[OrganizationId] = S.[OrganizationId]
|
||||
[SubvaultUser] SU ON SU.[SubvaultId] = S.[Id]
|
||||
INNER JOIN
|
||||
[OrganizationUser] OU ON OU.[Id] = SU.[OrganizationUserId]
|
||||
WHERE
|
||||
S.[Id] = @Id
|
||||
AND OU.[UserId] = @UserId
|
||||
AND OU.[Type] <= 1 -- Owner and admin
|
||||
OU.[UserId] = @UserId
|
||||
END
|
Loading…
Reference in New Issue
Block a user