Ban template system (#29365)

To help out admins, so they can easily fill out datacenter bans and stuff. Supports ban exemption flags and everything.

This is for use with SS14.Admin so it's just DB models here.
This commit is contained in:
Pieter-Jan Briers
2024-06-23 17:33:54 +02:00
committed by GitHub
parent 19bc6f961d
commit 0c34eb6138
7 changed files with 4068 additions and 0 deletions

View File

@@ -41,6 +41,7 @@ namespace Content.Server.Database
public DbSet<AdminWatchlist> AdminWatchlists { get; set; } = null!;
public DbSet<AdminMessage> AdminMessages { get; set; } = null!;
public DbSet<RoleWhitelist> RoleWhitelists { get; set; } = null!;
public DbSet<BanTemplate> BanTemplate { get; set; } = null!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
@@ -1134,4 +1135,57 @@ namespace Content.Server.Database
[Required]
public string RoleId { get; set; } = default!;
}
/// <summary>
/// Defines a template that admins can use to quickly fill out ban information.
/// </summary>
/// <remarks>
/// <para>
/// This information is not currently used by the game itself, but it is used by SS14.Admin.
/// </para>
/// </remarks>
public sealed class BanTemplate
{
public int Id { get; set; }
/// <summary>
/// Title of the ban template. This is purely for reference by admins and not copied into the ban.
/// </summary>
public required string Title { get; set; }
/// <summary>
/// How long the ban should last. 0 for permanent.
/// </summary>
public TimeSpan Length { get; set; }
/// <summary>
/// The reason for the ban.
/// </summary>
/// <seealso cref="ServerBan.Reason"/>
public string Reason { get; set; } = "";
/// <summary>
/// Exemptions granted to the ban.
/// </summary>
/// <seealso cref="ServerBan.ExemptFlags"/>
public ServerBanExemptFlags ExemptFlags { get; set; }
/// <summary>
/// Severity of the ban
/// </summary>
/// <seealso cref="ServerBan.Severity"/>
public NoteSeverity Severity { get; set; }
/// <summary>
/// Ban will be automatically deleted once expired.
/// </summary>
/// <seealso cref="ServerBan.AutoDelete"/>
public bool AutoDelete { get; set; }
/// <summary>
/// Ban is not visible to players in the remarks menu.
/// </summary>
/// <seealso cref="ServerBan.Hidden"/>
public bool Hidden { get; set; }
}
}