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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user