mirror of
https://github.com/bitwarden/server.git
synced 2025-06-02 01:00:33 -05: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:
parent
fe6181f55f
commit
c7b0c30370
@ -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);
|
||||
|
@ -45,9 +45,6 @@ public class OrganizationUserReplaceTests
|
||||
/// Tests OrganizationUsers in the Confirmed status, which is a stand-in for all other
|
||||
/// non-Invited statuses (which are all linked to a UserId).
|
||||
/// </summary>
|
||||
/// <param name="organizationRepository"></param>
|
||||
/// <param name="organizationUserRepository"></param>
|
||||
/// <param name="collectionRepository"></param>
|
||||
[DatabaseTheory, DatabaseData]
|
||||
public async Task ReplaceAsync_WithCollectionAccess_WhenUserIsConfirmed_Success(
|
||||
IUserRepository userRepository,
|
||||
|
Loading…
x
Reference in New Issue
Block a user