Admin Advanced Features - nself-org/nchat GitHub Wiki
Advanced Admin Features (v0.5.0)
Comprehensive guide to bulk operations, automation, system monitoring, and enhanced audit logging
Table of Contents
- Overview
- Bulk Operations
- Automation Engine
- System Health Monitoring
- Enhanced Audit Logs
- API Reference
- Best Practices
Overview
Version 0.5.0 introduces powerful administrative capabilities designed for enterprise deployments:
- Bulk Operations: Perform actions on multiple users/channels simultaneously
- Automation Engine: Schedule and automate administrative tasks
- Real-time Monitoring: Track system health and resource usage
- Enhanced Audit Logs: Advanced search, filtering, and export capabilities
Access Requirements
Required Roles: Owner, Admin
Location: /admin/advanced
Bulk Operations
Perform operations on multiple users, channels, or messages at once with progress tracking and error handling.
Bulk User Operations
1. Bulk Invite
Invite multiple users via email addresses.
Features:
- Parse email lists (newline, comma, or semicolon separated)
- Email validation
- Custom welcome messages
- Role assignment
- Progress tracking
Usage:
// Navigate to: /admin/advanced?tab=bulk-users
// Select "Invite" tab
// Paste email addresses:
[email protected]
[email protected], [email protected]
[email protected]; [email protected]
// Select default role
// Optional: Add custom welcome message
// Click "Send Invitations"
CSV Import Format:
email,role,displayName
[email protected],member,Alice Johnson
[email protected],moderator,Bob Smith
2. Bulk Suspend
Temporarily or permanently suspend user accounts.
Features:
- Suspension reason (required)
- Duration options: 7 days, 30 days, 90 days, permanent
- User notifications
- Batch processing
Usage:
- Select users from the user management table
- Navigate to "Suspend" tab
- Enter suspension reason
- Choose duration
- Confirm operation
3. Bulk Delete
Permanently delete user accounts.
Features:
- Confirmation required (type "DELETE")
- Option to delete associated messages
- Ownership transfer for channels
- Irreversible action warnings
Safety: Double confirmation required to prevent accidental deletions.
4. Bulk Role Assignment
Assign roles to multiple users simultaneously.
Features:
- Role selection from available roles
- Optional user notifications
- Immediate permission updates
Bulk Channel Operations
1. Bulk Archive
Archive multiple channels to keep them readonly.
Features:
- Optional archive reason
- Member notifications
- Preserves message history
2. Bulk Delete
Permanently delete multiple channels.
Features:
- Confirmation required (type "DELETE")
- Optional message archiving before deletion
- Member notifications
- Irreversible action warnings
3. Bulk Transfer Ownership
Transfer channel ownership to another user.
Features:
- Specify new owner by ID or email
- Notifications to old and new owners
- Maintains channel settings
4. Bulk Privacy Change
Change privacy settings for multiple channels.
Features:
- Make public or private
- Instant permission updates
- Member list preserved
CSV Export/Import
Export Users
id,username,displayName,email,role,isActive,isBanned,createdAt,messagesCount,channelsCount
user-123,alice,Alice Johnson,[email protected],member,true,false,2024-01-15T10:00:00Z,450,12
user-456,bob,Bob Smith,[email protected],moderator,true,false,2024-01-10T09:00:00Z,678,15
Export Channels
id,name,slug,description,type,isPrivate,isArchived,createdAt,membersCount,messagesCount
ch-123,general,general,General discussion,public,false,false,2024-01-01T00:00:00Z,156,4521
ch-456,engineering,engineering,Engineering team,private,true,false,2024-01-02T00:00:00Z,24,1856
Automation Engine
Schedule and automate administrative tasks with rule-based triggers and actions.
Rule Components
Every automation rule has:
- Trigger: When the rule should run
- Action: What the rule should do
- Conditions (optional): Filter criteria
- Configuration: Trigger and action parameters
Trigger Types
1. Schedule Trigger
Run on a cron schedule.
Examples:
0 0 * * *- Daily at midnight0 0 * * 0- Weekly on Sunday at midnight0 2 * * *- Daily at 2 AM0 9 * * 1- Monday at 9 AM
2. Event Triggers
user.created- New user account createduser.login- User logs inchannel.created- New channel createdmessage.created- New message posted
3. Time-based Triggers
channel.inactive- Channel inactive for X daysmessage.old- Message older than X daysuser.inactive- User inactive for X days
Action Types
1. Channel Actions
channel.archive- Archive inactive channelschannel.delete- Delete channels
Example Configuration:
{
trigger: 'schedule',
triggerConfig: {
schedule: { cron: '0 0 * * 0' }, // Weekly
inactivityDays: 90
},
action: 'channel.archive',
actionConfig: {
archiveChannel: {
reason: 'Archived due to 90 days of inactivity',
notifyMembers: true
}
}
}
2. Message Actions
message.delete- Delete old messages
Example - Retention Policy:
{
trigger: 'schedule',
triggerConfig: {
schedule: { cron: '0 2 * * *' }, // Daily at 2 AM
ageDays: 365
},
action: 'message.delete',
actionConfig: {
deleteMessages: {
reason: 'Retention policy: messages older than 1 year',
archiveFirst: true
}
}
}
3. User Actions
user.assign_role- Auto-assign rolesuser.send_email- Send automated emailsuser.suspend- Suspend inactive accounts
Example - Welcome Email:
{
trigger: 'user.created',
action: 'user.send_email',
actionConfig: {
sendEmail: {
templateId: 'welcome',
subject: 'Welcome to the team!',
customData: { /* template variables */ }
}
}
}
4. Report Actions
report.generate- Generate and send reports
Example - Weekly Report:
{
trigger: 'schedule',
triggerConfig: {
schedule: { cron: '0 9 * * 1' } // Monday at 9 AM
},
action: 'report.generate',
actionConfig: {
generateReport: {
reportType: 'activity',
format: 'pdf',
recipients: ['[email protected]'],
includeCharts: true
}
}
}
Rule Templates
Pre-configured templates for common automation scenarios:
- Archive Inactive Channels - Weekly archival of channels inactive for 90 days
- Delete Old Messages - Daily deletion of messages older than 1 year
- Auto-assign Member Role - Assign "member" role to new verified users
- Welcome Email - Send welcome email to new users
- Weekly Activity Report - Send activity reports to admins
- Suspend Inactive Users - Suspend accounts inactive for 180 days
Managing Rules
Create Rule
- Navigate to
/admin/advanced?tab=automation - Click "Create Rule"
- Choose from template or create custom
- Configure trigger and action
- Set conditions (optional)
- Save and activate
Edit Rule
- Click "Edit" icon on rule row
- Modify configuration
- Save changes
Control Rules
- Play: Activate rule
- Pause: Temporarily disable
- Run Now: Execute immediately (manual trigger)
- Duplicate: Create copy for customization
- Delete: Permanently remove
Execution History
View detailed execution logs:
- Start/completion times
- Items processed
- Success/failure counts
- Error details
System Health Monitoring
Real-time monitoring of system resources and service health.
Resource Monitoring
CPU Usage
- Current usage percentage
- Core count
- Load average (1m, 5m, 15m)
- Historical trends (20-minute chart)
Memory Usage
- Total/used/free memory
- Usage percentage
- Memory trends over time
Disk Usage
- Total/used/free storage
- Usage percentage
- Storage status (Healthy/Warning/Critical)
Status Thresholds:
- Healthy: < 50%
- Moderate: 50-75%
- Warning: 75-90%
- Critical: > 90%
Service Health
Monitor backend services:
- PostgreSQL (database)
- Hasura GraphQL (API)
- Auth Service (authentication)
- Storage (MinIO)
- Redis Cache
- MeiliSearch (search)
Metrics per Service:
- Status: Healthy/Degraded/Down
- Uptime duration
- Response time
- Last health check timestamp
Database Performance
PostgreSQL-specific metrics:
- Active connections
- Queries per second
- Average query time
Network Metrics
- Bytes in/out
- Active connections
- Connection trends
Auto-Refresh
- Toggle auto-refresh on/off
- Updates every 5 seconds when enabled
- Manual refresh button available
Enhanced Audit Logs
Comprehensive audit trail with advanced search, filtering, and export capabilities.
Event Types
User Events
user.created- User account createduser.updated- Profile updateduser.deleted- Account deleteduser.login- Login eventuser.logout- Logout eventuser.suspended- Account suspendeduser.role_changed- Role modified
Channel Events
channel.created- Channel createdchannel.updated- Settings updatedchannel.deleted- Channel deletedchannel.archived- Channel archived
Message Events
message.created- Message postedmessage.updated- Message editedmessage.deleted- Message deletedmessage.flagged- Message flagged
System Events
settings.updated- System settings changedautomation.created- Automation rule createdautomation.executed- Automation runbulk_operation.started- Bulk operation initiatedbulk_operation.completed- Bulk operation finished
Event Severity Levels
- Info: Normal operations (blue)
- Warning: Potentially concerning events (yellow)
- Error: Failed operations (red)
- Critical: Severe issues (dark red)
Advanced Filtering
Search
Free-text search across:
- Event descriptions
- Actor names
- Event types
Filters
- Event Type: Filter by category (user, channel, message, settings, automation)
- Severity: Filter by info, warning, error, critical
- Actor: Filter by specific user
- Date Range: Today, last 7 days, last 30 days, all time
Event Details
Click "View" icon to see complete event details:
- Full description
- Actor information (name, username, email)
- Target entity (if applicable)
- Technical details (IP address, user agent)
- Metadata (session ID, custom data)
- Exact timestamp
Export Options
CSV Export
timestamp,type,severity,actor,action,description,ipAddress
2024-01-29T14:30:00Z,user.created,info,Alice Johnson,created,Created new user account,192.168.1.10
JSON Export
[
{
"id": "event-123",
"type": "user.created",
"severity": "info",
"actor": {
"id": "user-1",
"username": "alice",
"displayName": "Alice Johnson",
"email": "[email protected]"
},
"description": "Created new user account",
"timestamp": "2024-01-29T14:30:00Z",
"ipAddress": "192.168.1.10",
"metadata": { "sessionId": "session-456" }
}
]
Retention Policies
Configure audit log retention:
- Automatic cleanup of old logs
- Configurable retention periods
- Export before deletion option
API Reference
Bulk Operations API
Endpoint: POST /api/admin/bulk-operations
Request Body:
{
type: BulkOperationType,
parameters: Record<string, unknown>
}
Response:
{
success: boolean,
operationId: string,
totalItems: number,
message: string,
errors?: Array<{
itemId: string,
error: string
}>
}
Example: Bulk User Invite
POST /api/admin/bulk-operations
{
"type": "user.invite",
"parameters": {
"emails": ["[email protected]", "[email protected]"],
"roleId": "member",
"sendWelcomeEmail": true,
"customMessage": "Welcome to our team!"
}
}
Response:
{
"success": true,
"operationId": "op-123",
"totalItems": 2,
"message": "Successfully sent 2 invitations"
}
Example: Bulk Channel Archive
POST /api/admin/bulk-operations
{
"type": "channel.archive",
"parameters": {
"channelIds": ["ch-1", "ch-2", "ch-3"],
"reason": "Inactive for 90 days",
"notifyMembers": true
}
}
Response:
{
"success": true,
"operationId": "op-456",
"totalItems": 3,
"message": "Successfully archived 3 channels"
}
Supported Operations
user.invite- Invite usersuser.suspend- Suspend usersuser.delete- Delete usersuser.role.assign- Assign roleschannel.archive- Archive channelschannel.delete- Delete channelschannel.transfer- Transfer ownershipchannel.privacy.change- Change privacymessage.delete- Delete messagesmessage.flag- Flag messages
Best Practices
Bulk Operations
- Test First: Start with small batches to verify behavior
- Use Filters: Apply filters before bulk operations to ensure correct targets
- Monitor Progress: Watch the progress tracker for errors
- Export Before Delete: Always export data before permanent deletions
- Notifications: Enable notifications for transparency
- Double-Check: Review selected items before confirming destructive actions
Automation Rules
- Start Disabled: Create rules in disabled state, test manually first
- Conservative Schedules: Don't run intensive operations too frequently
- Monitor Executions: Regularly check execution history for issues
- Use Conditions: Add conditions to prevent unintended actions
- Archive Before Delete: Always archive before deletion in automation
- Notify Stakeholders: Enable notifications for important automations
System Monitoring
- Set Up Alerts: Configure alerts for critical thresholds
- Regular Reviews: Check system health dashboard daily
- Baseline Metrics: Understand normal resource usage patterns
- Act on Warnings: Investigate degraded services promptly
- Capacity Planning: Use trends to predict future resource needs
Audit Logs
- Regular Exports: Export logs periodically for backup
- Retention Policies: Configure appropriate retention periods
- Security Reviews: Audit failed login attempts and security events
- Compliance: Use exports for compliance reporting
- Investigation: Leverage detailed event data for troubleshooting
Troubleshooting
Bulk Operation Stuck
Symptoms: Operation shows as "running" but no progress
Solutions:
- Check network connection
- Refresh the page
- Check browser console for errors
- Contact support if persists
Automation Not Running
Symptoms: Scheduled rule not executing
Solutions:
- Verify rule status is "active"
- Check cron expression syntax
- Review execution history for errors
- Ensure system time is correct
High Resource Usage
Symptoms: CPU/Memory/Disk usage in critical range
Solutions:
- Check recent bulk operations
- Review automation schedules
- Investigate database queries
- Scale resources if needed
Missing Audit Events
Symptoms: Expected events not appearing in logs
Solutions:
- Check date range filter
- Verify severity filter settings
- Try clearing all filters
- Check retention policy
Support
For issues or questions:
- Documentation:
/docs - Admin Dashboard:
/admin/advanced - System Health:
/admin/advanced?tab=monitoring - Audit Trail:
/admin/advanced?tab=audit
Version: 0.5.0 Last Updated: January 30, 2026 Maintainer: nself-chat Team