diff --git a/src/Sql/Sql.sqlproj b/src/Sql/Sql.sqlproj index f7d0131cc..55e6ec22f 100644 --- a/src/Sql/Sql.sqlproj +++ b/src/Sql/Sql.sqlproj @@ -179,5 +179,6 @@ + \ 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 new file mode 100644 index 000000000..ecdb7af40 --- /dev/null +++ b/src/Sql/dbo/Stored Procedures/Subvault_ReadByIdAdminUserId.sql @@ -0,0 +1,19 @@ +CREATE PROCEDURE [dbo].[Subvault_ReadByIdAdminUserId] + @Id UNIQUEIDENTIFIER, + @UserId UNIQUEIDENTIFIER +AS +BEGIN + SET NOCOUNT ON + + SELECT + S.* + FROM + [dbo].[SubvaultView] S + INNER JOIN + [OrganizationUser] OU ON OU.[OrganizationId] = S.[OrganizationId] + WHERE + S.[Id] = @Id + AND OU.[UserId] = @UserId + AND OU.[Status] = 2 -- Confirmed + AND OU.[Type] <= 1 -- Owner and admin +END \ No newline at end of file diff --git a/src/Sql/dbo/Stored Procedures/Subvault_ReadByOrganizationIdAdminUserId.sql b/src/Sql/dbo/Stored Procedures/Subvault_ReadByOrganizationIdAdminUserId.sql index 86853cba3..17662dd87 100644 --- a/src/Sql/dbo/Stored Procedures/Subvault_ReadByOrganizationIdAdminUserId.sql +++ b/src/Sql/dbo/Stored Procedures/Subvault_ReadByOrganizationIdAdminUserId.sql @@ -14,5 +14,6 @@ BEGIN WHERE S.[OrganizationId] = @OrganizationId AND OU.[UserId] = @UserId + AND OU.[Status] = 2 -- Confirmed AND OU.[Type] <= 1 -- Owner and admin END \ No newline at end of file