mirror of
https://github.com/bitwarden/server.git
synced 2024-11-21 12:05:42 +01:00
Naming corrections. And corrected EF query.
This commit is contained in:
parent
273754adc6
commit
2f3da19b64
@ -30,7 +30,7 @@ public class RevokeNonCompliantOrganizationUserCommand(IOrganizationUserReposito
|
||||
return validationResult;
|
||||
}
|
||||
|
||||
await organizationUserRepository.RevokeOrganizationUserAsync(request.OrganizationUsers.Select(x => x.Id));
|
||||
await organizationUserRepository.RevokeManyByIdAsync(request.OrganizationUsers.Select(x => x.Id));
|
||||
|
||||
var now = timeProvider.GetUtcNow();
|
||||
|
||||
|
@ -59,5 +59,5 @@ public interface IOrganizationUserRepository : IRepository<OrganizationUser, Gui
|
||||
/// </summary>
|
||||
Task<ICollection<OrganizationUser>> GetManyByOrganizationWithClaimedDomainsAsync(Guid organizationId);
|
||||
|
||||
Task RevokeOrganizationUserAsync(IEnumerable<Guid> userIds);
|
||||
Task RevokeManyByIdAsync(IEnumerable<Guid> organizationUserIds);
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ public class OrganizationUserRepository : Repository<OrganizationUser, Guid>, IO
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RevokeOrganizationUserAsync(IEnumerable<Guid> organizationUserIds)
|
||||
public async Task RevokeManyByIdAsync(IEnumerable<Guid> organizationUserIds)
|
||||
{
|
||||
await using var connection = new SqlConnection(ConnectionString);
|
||||
|
||||
|
@ -722,15 +722,15 @@ public class OrganizationUserRepository : Repository<Core.Entities.OrganizationU
|
||||
}
|
||||
}
|
||||
|
||||
public async Task RevokeOrganizationUserAsync(IEnumerable<Guid> userIds)
|
||||
public async Task RevokeManyByIdAsync(IEnumerable<Guid> organizationUserIds)
|
||||
{
|
||||
using var scope = ServiceScopeFactory.CreateScope();
|
||||
|
||||
var dbContext = GetDatabaseContext(scope);
|
||||
|
||||
await dbContext.OrganizationUsers.Where(x => userIds.Contains(x.OrganizationId))
|
||||
await dbContext.OrganizationUsers.Where(x => organizationUserIds.Contains(x.Id))
|
||||
.ExecuteUpdateAsync(s => s.SetProperty(x => x.Status, OrganizationUserStatusType.Revoked));
|
||||
|
||||
await dbContext.UserBumpAccountRevisionDateByOrganizationUserIdsAsync(userIds);
|
||||
await dbContext.UserBumpAccountRevisionDateByOrganizationUserIdsAsync(organizationUserIds);
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class RevokeNonCompliantOrganizationUserCommandTests
|
||||
|
||||
await sutProvider.GetDependency<IOrganizationUserRepository>()
|
||||
.Received(1)
|
||||
.RevokeOrganizationUserAsync(Arg.Any<IEnumerable<Guid>>());
|
||||
.RevokeManyByIdAsync(Arg.Any<IEnumerable<Guid>>());
|
||||
|
||||
Assert.True(result.Success);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user