Add moderation permissions and durable player records

This commit is contained in:
2026-10-15 21:06:08 -04:00
parent c1758cce25
commit c91d49c298
17 changed files with 699 additions and 21 deletions
+12 -1
View File
@@ -1,4 +1,6 @@
export type UserRole = 'admin' | 'super_viewer' | 'operator' | 'viewer';
export type UserRole = 'admin' | 'super_viewer' | 'operator' | 'moderator' | 'viewer';
export const moderatorMaximumRestrictionMs = 7 * 24 * 60 * 60 * 1000;
/** Reserved identity for work requested by the controller. */
export const systemUsername = 'Maxis';
@@ -19,6 +21,7 @@ export const roleLabels: Record<UserRole, string> = {
admin: 'Administrator',
super_viewer: 'Super Viewer',
operator: 'Operator',
moderator: 'Moderator',
viewer: 'Viewer'
};
@@ -33,3 +36,11 @@ export function canReadAdmin(role: UserRole | null | undefined): boolean {
export function canReadSensitive(role: UserRole | null | undefined): boolean {
return canOperate(role) || role === 'super_viewer';
}
export function canModerate(role: UserRole | null | undefined): boolean {
return role === 'admin' || role === 'moderator';
}
export function canReadModeration(role: UserRole | null | undefined): boolean {
return canModerate(role) || role === 'super_viewer';
}