Ajoute une table de gestion des utilisateurs
This commit is contained in:
@@ -123,6 +123,11 @@ public sealed class MySqlUserProfileStore(
|
||||
ORDER BY updated_utc DESC, created_utc DESC, username ASC;
|
||||
""";
|
||||
|
||||
private const string DeleteProfileSql = """
|
||||
DELETE FROM site_users
|
||||
WHERE subject = @subject;
|
||||
""";
|
||||
|
||||
private readonly SiteDataOptions _options = options.Value;
|
||||
private readonly ILogger<MySqlUserProfileStore> _logger = logger;
|
||||
|
||||
@@ -285,6 +290,17 @@ public sealed class MySqlUserProfileStore(
|
||||
return await ReadProfileAsync(connection, subject, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(string subject, CancellationToken cancellationToken)
|
||||
{
|
||||
await using var connection = new MySqlConnection(_options.BuildConnectionString());
|
||||
await connection.OpenAsync(cancellationToken);
|
||||
|
||||
await using var command = connection.CreateCommand();
|
||||
command.CommandText = DeleteProfileSql;
|
||||
command.Parameters.AddWithValue("@subject", subject);
|
||||
await command.ExecuteNonQueryAsync(cancellationToken);
|
||||
}
|
||||
|
||||
private static UserProfileInput NormalizeInput(AuthenticatedSiteUser user, UpdateUserProfileRequest request)
|
||||
=> NormalizeInput(user.DisplayName, request);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user