1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-24 12:35:25 +01:00

Naming corrections. And corrected EF query.

This commit is contained in:
jrmccannon 2024-11-20 13:00:15 -06:00
parent 273754adc6
commit 2f3da19b64
No known key found for this signature in database
GPG Key ID: CF03F3DB01CE96A6
5 changed files with 7 additions and 7 deletions

View File

@ -30,7 +30,7 @@ public class RevokeNonCompliantOrganizationUserCommand(IOrganizationUserReposito
return validationResult; return validationResult;
} }
await organizationUserRepository.RevokeOrganizationUserAsync(request.OrganizationUsers.Select(x => x.Id)); await organizationUserRepository.RevokeManyByIdAsync(request.OrganizationUsers.Select(x => x.Id));
var now = timeProvider.GetUtcNow(); var now = timeProvider.GetUtcNow();

View File

@ -59,5 +59,5 @@ public interface IOrganizationUserRepository : IRepository<OrganizationUser, Gui
/// </summary> /// </summary>
Task<ICollection<OrganizationUser>> GetManyByOrganizationWithClaimedDomainsAsync(Guid organizationId); Task<ICollection<OrganizationUser>> GetManyByOrganizationWithClaimedDomainsAsync(Guid organizationId);
Task RevokeOrganizationUserAsync(IEnumerable<Guid> userIds); Task RevokeManyByIdAsync(IEnumerable<Guid> organizationUserIds);
} }

View File

@ -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); await using var connection = new SqlConnection(ConnectionString);

View File

@ -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(); using var scope = ServiceScopeFactory.CreateScope();
var dbContext = GetDatabaseContext(scope); 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)); .ExecuteUpdateAsync(s => s.SetProperty(x => x.Status, OrganizationUserStatusType.Revoked));
await dbContext.UserBumpAccountRevisionDateByOrganizationUserIdsAsync(userIds); await dbContext.UserBumpAccountRevisionDateByOrganizationUserIdsAsync(organizationUserIds);
} }
} }

View File

@ -161,7 +161,7 @@ public class RevokeNonCompliantOrganizationUserCommandTests
await sutProvider.GetDependency<IOrganizationUserRepository>() await sutProvider.GetDependency<IOrganizationUserRepository>()
.Received(1) .Received(1)
.RevokeOrganizationUserAsync(Arg.Any<IEnumerable<Guid>>()); .RevokeManyByIdAsync(Arg.Any<IEnumerable<Guid>>());
Assert.True(result.Success); Assert.True(result.Success);
} }