Server ban exemption system (#15076)
This commit is contained in:
committed by
GitHub
parent
e037d12899
commit
c8e90e561b
@@ -84,6 +84,23 @@ namespace Content.Server.Database
|
||||
|
||||
Task AddServerBanAsync(ServerBanDef serverBan);
|
||||
Task AddServerUnbanAsync(ServerUnbanDef serverBan);
|
||||
|
||||
/// <summary>
|
||||
/// Update ban exemption information for a player.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Database rows are automatically created and removed when appropriate.
|
||||
/// </remarks>
|
||||
/// <param name="userId">The user to update</param>
|
||||
/// <param name="flags">The new ban exemption flags.</param>
|
||||
Task UpdateBanExemption(NetUserId userId, ServerBanExemptFlags flags);
|
||||
|
||||
/// <summary>
|
||||
/// Get current ban exemption flags for a user
|
||||
/// </summary>
|
||||
/// <returns><see cref="ServerBanExemptFlags.None"/> if the user is not exempt from any bans.</returns>
|
||||
Task<ServerBanExemptFlags> GetBanExemption(NetUserId userId);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Role Bans
|
||||
@@ -353,6 +370,18 @@ namespace Content.Server.Database
|
||||
return _db.AddServerUnbanAsync(serverUnban);
|
||||
}
|
||||
|
||||
public Task UpdateBanExemption(NetUserId userId, ServerBanExemptFlags flags)
|
||||
{
|
||||
DbWriteOpsMetric.Inc();
|
||||
return _db.UpdateBanExemption(userId, flags);
|
||||
}
|
||||
|
||||
public Task<ServerBanExemptFlags> GetBanExemption(NetUserId userId)
|
||||
{
|
||||
DbReadOpsMetric.Inc();
|
||||
return _db.GetBanExemption(userId);
|
||||
}
|
||||
|
||||
#region Role Ban
|
||||
public Task<ServerRoleBanDef?> GetServerRoleBanAsync(int id)
|
||||
{
|
||||
@@ -742,10 +771,10 @@ namespace Content.Server.Database
|
||||
return true;
|
||||
}
|
||||
|
||||
public IDisposable BeginScope<TState>(TState state)
|
||||
public IDisposable? BeginScope<TState>(TState state) where TState : notnull
|
||||
{
|
||||
// TODO: this
|
||||
return null!;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user