mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-06-09 13:26:34 +02:00
29b7fc4463
Ban database refactor (#42495) * Ban DB refactor seems to work at a basic level for PostgreSQL * New ban creation API Supports all the new functionality (multiple players/addresses/hwids/roles/rounds per ban). * Make the migration irreversible * Re-implement ban notifications The server ID check is no longer done as admins may want to place bans spanning multiple rounds irrelevant of the source server. * Fix some split query warnings * Implement migration on SQLite * More comments * Remove required from ban reason SS14.Admin changes would like this * More missing AsSplitQuery() calls * Fix missing ban type filter * Fix old CreateServerBan API with permanent time * Fix department and role ban commands with permanent time * Re-add banhits navigation property Dropped this on accident, SS14.Admin needs it. * More ban API fixes. * Don't fetch ban exemption info for role bans Not relevant, reduces query performance * Regenerate migrations * Fix adminnotes command for players that never connected Would blow up handling null player records. Not a new bug introduced by the refactor, but I ran into it. * Great shame... I accidentally committed submodule update... * Update GDPR scripts * Fix sandbox violation * Fix bans with duplicate info causing DB exceptions Most notably happened with role bans, as multiple departments may include the same role.
59 lines
2.7 KiB
C#
59 lines
2.7 KiB
C#
using System.Threading.Tasks;
|
|
using Content.Server.Database;
|
|
using Content.Shared.Administration.Notes;
|
|
using Content.Shared.Database;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Server.Administration.Notes;
|
|
|
|
public interface IAdminNotesManager
|
|
{
|
|
event Action<SharedAdminNote>? NoteAdded;
|
|
event Action<SharedAdminNote>? NoteModified;
|
|
event Action<SharedAdminNote>? NoteDeleted;
|
|
|
|
bool CanCreate(ICommonSession admin);
|
|
bool CanDelete(ICommonSession admin);
|
|
bool CanEdit(ICommonSession admin);
|
|
bool CanView(ICommonSession admin);
|
|
Task OpenEui(ICommonSession admin, NetUserId notedPlayer);
|
|
Task OpenUserNotesEui(ICommonSession player);
|
|
Task AddAdminRemark(ICommonSession createdBy, Guid player, NoteType type, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime);
|
|
Task DeleteAdminRemark(int noteId, NoteType type, ICommonSession deletedBy);
|
|
Task ModifyAdminRemark(int noteId, NoteType type, ICommonSession editedBy, string message, NoteSeverity? severity, bool secret, DateTime? expiryTime);
|
|
/// <summary>
|
|
/// Queries the database and retrieves all notes, secret and visible
|
|
/// </summary>
|
|
/// <param name="player">Desired player's <see cref="Guid"/></param>
|
|
/// <returns>ALL non-deleted notes, secret or not</returns>
|
|
Task<List<IAdminRemarksRecord>> GetAllAdminRemarks(Guid player);
|
|
/// <summary>
|
|
/// Queries the database and retrieves the notes a player should see
|
|
/// </summary>
|
|
/// <param name="player">Desired player's <see cref="Guid"/></param>
|
|
/// <returns>All player-visible notes</returns>
|
|
Task<List<IAdminRemarksRecord>> GetVisibleRemarks(Guid player);
|
|
/// <summary>
|
|
/// Queries the database and retrieves watchlists that may have been placed on the player
|
|
/// </summary>
|
|
/// <param name="player">Desired player's <see cref="Guid"/></param>
|
|
/// <returns>Active watchlists</returns>
|
|
Task<List<AdminWatchlistRecord>> GetActiveWatchlists(Guid player);
|
|
/// <summary>
|
|
/// Queries the database and retrieves new messages a player has gotten
|
|
/// </summary>
|
|
/// <param name="player">Desired player's <see cref="Guid"/></param>
|
|
/// <returns>All unread messages</returns>
|
|
Task<List<AdminMessageRecord>> GetNewMessages(Guid player);
|
|
|
|
/// <summary>
|
|
/// Mark an admin message as being seen by the target player.
|
|
/// </summary>
|
|
/// <param name="id">The database ID of the admin message.</param>
|
|
/// <param name="dismissedToo">
|
|
/// If true, the message is "permanently dismissed" and will not be shown to the player again when they join.
|
|
/// </param>
|
|
Task MarkMessageAsSeen(int id, bool dismissedToo);
|
|
}
|