diff --git a/src/Sql/Sql.sqlproj b/src/Sql/Sql.sqlproj
index f2d93b662..84592c2a5 100644
--- a/src/Sql/Sql.sqlproj
+++ b/src/Sql/Sql.sqlproj
@@ -159,5 +159,7 @@
+
+
\ No newline at end of file
diff --git a/src/Sql/dbo/Stored Procedures/Cipher_ReadByUserIdHasSubvault.sql b/src/Sql/dbo/Stored Procedures/Cipher_ReadByUserIdHasSubvault.sql
new file mode 100644
index 000000000..592bd7184
--- /dev/null
+++ b/src/Sql/dbo/Stored Procedures/Cipher_ReadByUserIdHasSubvault.sql
@@ -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
\ No newline at end of file
diff --git a/src/Sql/dbo/Stored Procedures/SubvaultCipher_ReadByUserId.sql b/src/Sql/dbo/Stored Procedures/SubvaultCipher_ReadByUserId.sql
new file mode 100644
index 000000000..0efcb1c39
--- /dev/null
+++ b/src/Sql/dbo/Stored Procedures/SubvaultCipher_ReadByUserId.sql
@@ -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
\ No newline at end of file
diff --git a/src/Sql/dbo/Stored Procedures/Subvault_ReadByIdAdminUserId.sql b/src/Sql/dbo/Stored Procedures/Subvault_ReadByIdAdminUserId.sql
index 23658d760..6111d2ad8 100644
--- a/src/Sql/dbo/Stored Procedures/Subvault_ReadByIdAdminUserId.sql
+++ b/src/Sql/dbo/Stored Procedures/Subvault_ReadByIdAdminUserId.sql
@@ -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
\ No newline at end of file