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:
parent
273754adc6
commit
2f3da19b64
@ -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();
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user