1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00
bitwarden-server/util/Migrator/DbScripts/2022-11-18_00_PolicyReadByUserIdRemoveEnabledOrgCheck.sql
Jared Snider a791f93051
Defect/SG-825 - users in org w/ no personal vault still see personal vault (disabled org policies now still apply) (#2429)
* SG-825 - Policy_ReadByUserId stored proc now pulls back policies of disabled orgs

* SG-825 - SyncController - Always retrieve policies -- even if orgs are disabled.

* SG-825 - EF - PolicyReadByUserId - autoformat to remove whitespace and pass eslint build error
2022-12-16 15:22:39 -05:00

25 lines
478 B
Transact-SQL

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[Policy_ReadByUserId]
@UserId UNIQUEIDENTIFIER
AS
BEGIN
SET NOCOUNT ON
SELECT
P.*
FROM
[dbo].[PolicyView] P
INNER JOIN
[dbo].[OrganizationUser] OU ON P.[OrganizationId] = OU.[OrganizationId]
INNER JOIN
[dbo].[Organization] O ON OU.[OrganizationId] = O.[Id]
WHERE
OU.[UserId] = @UserId
AND OU.[Status] = 2 -- 2 = Confirmed
END
GO