1
0
mirror of https://github.com/bitwarden/server synced 2025-12-14 07:13:39 +00:00

Bump account revision date in OrgUserRepository (#5884)

Match equivalent MSSQL logic. Also ensures that the revision date
is bumped when the user is revoked.
This commit is contained in:
Thomas Rittson
2025-05-29 07:30:23 +10:00
committed by GitHub
parent fe6181f55f
commit c7b0c30370
2 changed files with 3 additions and 10 deletions

View File

@@ -1,5 +1,4 @@
using System.Diagnostics;
using AutoMapper;
using AutoMapper;
using Bit.Core.AdminConsole.Enums;
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Models;
using Bit.Core.Enums;
@@ -446,15 +445,12 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
{
await base.ReplaceAsync(organizationUser);
// Only bump account revision dates for confirmed OrgUsers,
// as this is the only status that receives sync data from the organization
if (organizationUser.Status is not OrganizationUserStatusType.Confirmed)
// Only bump the account revision date if linked to a user account
if (!organizationUser.UserId.HasValue)
{
return;
}
Debug.Assert(organizationUser.UserId is not null, "OrganizationUser is confirmed but does not have a UserId.");
using var scope = ServiceScopeFactory.CreateScope();
var dbContext = GetDatabaseContext(scope);
await dbContext.UserBumpAccountRevisionDateAsync(organizationUser.UserId.Value);