1
0
mirror of https://github.com/bitwarden/server synced 2025-12-16 08:13:33 +00:00

[PM-26632] - Adding Idempotent Confirm User (#6459)

* Added repo call for idempotent user confirm. PLUS TESTS!

* Code review changes
This commit is contained in:
Jared McCannon
2025-10-16 11:19:48 -05:00
committed by GitHub
parent 132db95fb7
commit 449603d180
7 changed files with 284 additions and 7 deletions

View File

@@ -15,8 +15,6 @@ using Dapper;
using Microsoft.Data.SqlClient;
using Microsoft.Extensions.Logging;
#nullable enable
namespace Bit.Infrastructure.Dapper.Repositories;
public class OrganizationUserRepository : Repository<OrganizationUser, Guid>, IOrganizationUserRepository
@@ -672,4 +670,20 @@ public class OrganizationUserRepository : Repository<OrganizationUser, Guid>, IO
},
commandType: CommandType.StoredProcedure);
}
public async Task<bool> ConfirmOrganizationUserAsync(OrganizationUser organizationUser)
{
await using var connection = new SqlConnection(_marsConnectionString);
var rowCount = await connection.ExecuteScalarAsync<int>(
$"[{Schema}].[OrganizationUser_ConfirmById]",
new
{
organizationUser.Id,
organizationUser.UserId,
RevisionDate = DateTime.UtcNow.Date
});
return rowCount > 0;
}
}