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:
@ -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]
|
||||
|
Reference in New Issue
Block a user