1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

SM-718: Delete appropriate Access Policies on Org deletion (#2868)

* SM-718: Delete appropriate Access Policies on Org deletion

* SM-718: Add migration script for SPROC change

* SM-718: Add GO statement to migration script

* SM-718: Fix GroupUser bug that was also found
This commit is contained in:
Colton Hurst
2023-04-21 14:34:18 -04:00
committed by GitHub
parent 50dcec6d44
commit f961787396
2 changed files with 147 additions and 0 deletions

View File

@ -45,6 +45,22 @@ BEGIN
WHERE
[OU].[OrganizationId] = @Id
DELETE AP
FROM
[dbo].[AccessPolicy] AP
INNER JOIN
[dbo].[OrganizationUser] OU ON [AP].[OrganizationUserId] = [OU].[Id]
WHERE
[OU].[OrganizationId] = @Id
DELETE GU
FROM
[dbo].[GroupUser] GU
INNER JOIN
[dbo].[OrganizationUser] OU ON [GU].[OrganizationUserId] = [OU].[Id]
WHERE
[OU].[OrganizationId] = @Id
DELETE
FROM
[dbo].[OrganizationUser]
@ -82,6 +98,14 @@ BEGIN
WHERE
[SA].[OrganizationId] = @Id
DELETE AP
FROM
[dbo].[AccessPolicy] AP
INNER JOIN
[dbo].[ServiceAccount] SA ON [AP].[GrantedServiceAccountId] = [SA].[Id]
WHERE
[SA].[OrganizationId] = @Id
DELETE
FROM
[dbo].[ServiceAccount]