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

Fix organization delete sponsorship hooks

This commit is contained in:
Matt Gibson
2021-11-11 15:00:16 -05:00
committed by Justin Baur
parent 0fb44eb641
commit 5e20c3ff2d
4 changed files with 5 additions and 5 deletions

View File

@ -101,7 +101,7 @@ namespace Bit.Core.Repositories.EntityFramework
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var orgUser = dbContext.FindAsync<EFModel.Organization>(organization.Id);
var orgEntity = await dbContext.FindAsync<EFModel.Organization>(organization.Id);
var sponsorships = dbContext.OrganizationSponsorships
.Where(os =>
os.SponsoringOrganizationId == organization.Id ||
@ -115,7 +115,7 @@ namespace Bit.Core.Repositories.EntityFramework
sponsorship.SponsoringOrganizationId = UpdatedOrgId(sponsorship.SponsoringOrganizationId);
}
dbContext.Remove(orgUser);
dbContext.Remove(orgEntity);
await dbContext.SaveChangesAsync();
}
}

View File

@ -73,7 +73,7 @@ namespace Bit.Core.Repositories.EntityFramework
using (var scope = ServiceScopeFactory.CreateScope())
{
var dbContext = GetDatabaseContext(scope);
var orgUser = dbContext.FindAsync<EfModel.OrganizationUser>(organizationUserId);
var orgUser = await dbContext.FindAsync<EfModel.OrganizationUser>(organizationUserId);
var sponsorships = dbContext.OrganizationSponsorships
.Where(os => os.SponsoringOrganizationUserId != default &&
os.SponsoringOrganizationUserId.Value == organizationUserId);

View File

@ -34,7 +34,7 @@ BEGIN
WHERE
[OrganizationUserId] = @Id
EXEC [dbo].[OrganizationUser_DeleteById] @Id
EXEC [dbo].[OrganizationSponsorship_OrganizationUserDeleted] @Id
DELETE
FROM

View File

@ -512,7 +512,7 @@ BEGIN
WHERE
[OrganizationUserId] = @Id
EXEC [dbo].[OrganizationUser_DeleteById] @Id
EXEC [dbo].[OrganizationSponsorship_OrganizationUserDeleted] @Id
DELETE
FROM