Files
SocialPub/PrivaPub/Models/AdminAction.cs
T
thepraandClaude Opus 5.5 9f68ca3ed0 R6 moderation: roles, silence and suspension, bans that write nothing on the personas, deletions, report actions
Roles (user, moderator, administrator) from the CLI and /clientapi/admin/roots/{id}/role, never one's own nor the last
administrator. Silence keeps an account's posts out of public timelines, hashtags, trends, search and relays while its
followers still get them; suspension refuses and revokes a local persona's tokens, answers 404 for its posts and
collections, holds back every delivery and tells other servers nothing new, its actor unchanged; a suspended remote
account's activities are dropped and nothing goes to its own inbox (a shared one still serves its server). A banned
login's personas are held back in memory alone (Restrictions), so nothing pairs them in stored data. Personas and groups
are deleted one at a time (PersonaRemoval, GroupRemoval), by their login or an administrator with the password. Reports
resolve with an action and a note; posts are taken down, a remote copy hidden. Warnings reach the persona as Mastodon's
moderation_warning. Every staff act goes to the staff's log. Migration _020 limits posts from servers already silenced;
a restore keeps the moderation made since the backup.

Verified: interop.sh moderation gts mastodon with SecureMode, 194 passed; restore.sh, 25 passed, now with a suspension,
a silence and a takedown made after the backup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
2026-10-17 05:23:45 +02:00

82 lines
3.6 KiB
C#

using MongoDB.Entities;
namespace PrivaPub.Models
{
// One act of the server's staff, kept for the moderators' log (Domain/Moderation/ModerationLog.cs, completion program
// R5): who (an administrator's or moderator's root id, or "cli" for the command line), what, and on what. Never an IP
// address, and never a root next to its own personas: an entry about a persona drops the acting root when the persona
// is that root's, and an entry about a root names none of its personas. A backup holds the log and a restore keeps
// every entry made since (ProtectiveMerge).
public class AdminAction : Entity
{
public const string Cli = "cli";
public DateTime At { get; set; } = DateTime.UtcNow;
public string ByRootId { get; set; }
public string Action { get; set; }//AdminActions.*
public string TargetKind { get; set; }//AdminTargets.*
public string TargetId { get; set; }
public string TargetLabel { get; set; }
public string ReportId { get; set; }
public string Note { get; set; }
}
public static class AdminActions
{
public const string DomainBlockInsert = "domain_block.insert";
public const string DomainBlockDelete = "domain_block.delete";
public const string BackupCreate = "backup.create";
public const string BackupDelete = "backup.delete";
public const string BackupRestore = "backup.restore";
public const string SettingsUpdate = "settings.update";
public const string SettingsThumbnail = "settings.thumbnail";
public const string RuleInsert = "rule.insert";
public const string RuleUpdate = "rule.update";
public const string RuleDelete = "rule.delete";
public const string AnnouncementInsert = "announcement.insert";
public const string AnnouncementUpdate = "announcement.update";
public const string AnnouncementDelete = "announcement.delete";
public const string RelayInsert = "relay.insert";
public const string RelayDelete = "relay.delete";
public const string ReportResolve = "report.resolve";
public const string RootPromote = "root.promote";
public const string RootDemote = "root.demote";
public const string RootCreate = "root.create";
public const string RootDelete = "root.delete";
public const string RootResetTotp = "root.reset_totp";
public const string PersonaMove = "persona.move";
// moderation (completion program R6)
public const string RootRole = "root.role";
public const string RootBan = "root.ban";
public const string RootUnban = "root.unban";
public const string PersonaSilence = "persona.silence";
public const string PersonaUnsilence = "persona.unsilence";
public const string PersonaSuspend = "persona.suspend";
public const string PersonaUnsuspend = "persona.unsuspend";
public const string PersonaDelete = "persona.delete";
public const string AccountSilence = "account.silence";
public const string AccountUnsilence = "account.unsilence";
public const string AccountSuspend = "account.suspend";
public const string AccountUnsuspend = "account.unsuspend";
public const string GroupDelete = "group.delete";
public const string PostRemove = "post.remove";
}
public static class AdminTargets
{
public const string Root = "root";
public const string Persona = "persona";
public const string Account = "account";
public const string Domain = "domain";
public const string Report = "report";
public const string Settings = "settings";
public const string Rule = "rule";
public const string Announcement = "announcement";
public const string Emoji = "emoji";
public const string Relay = "relay";
public const string Backup = "backup";
public const string Group = "group";
public const string Post = "post";
}
}