Admin Roles & Audit Logs
Relevant source files
The following files were used as context for generating this wiki page:
The Admin Management system provides structured oversight for Telegram channels and groups through a multi-tiered role hierarchy. It enables granular permission control and security monitoring via audit logs, ensuring that channel operations remain secure and accountable.
This module integrates with the broader management suite, including Smart Broadcasting and Moderation, to restrict sensitive actions to authorized personnel.
Sources: README.md:158-160
Admin Roles Hierarchy
The system defines three distinct administrative roles to manage access levels. Each role grants specific capabilities, allowing for a delegated management structure within the dashboard.
Role Definitions
| Role | Description | Key Capabilities |
|---|---|---|
| Super Admin | Highest authority level | Full system access, role assignment, and global settings management. |
| Admin | Standard management level | Channel configuration, broadcasting, and member management. |
| Moderator | Operational support level | Prohibited word filtering and basic member oversight. |
Sources: README.md:158-159
Permission Logic
Admin roles utilize granular permissions to restrict access to specific dashboard features. For example, specific commands can be flagged as "admin-only" to prevent unauthorized usage by general group members.
Sources: README.md:124, README.md:159
The diagram shows the hierarchical inheritance of authority between the three defined roles.
Sources: README.md:158-160
Security and Audit Logs
The audit log system records actions performed by administrators to maintain transparency and security. This is complemented by enterprise-grade security features that protect administrative sessions.
Security Controls
- Two-Factor Authentication (2FA): Secures admin logins against unauthorized access.
- Full Audit Log: Tracks administrative actions for accountability.
- IP Tracking: Monitors session locations to detect suspicious activity.
- Account Lockout: Prevents brute-force attempts on admin credentials.
Sources: README.md:160-169
Session Management
The system tracks sessions and implements rate limiting to ensure platform stability and security. Protection against common web vulnerabilities like CSRF, XSS, and SQL injection is integrated into the management panel.
Sources: README.md:167-169
The sequence shows how the system validates an administrator's authority and records the event in the audit log before completing a request.
Sources: README.md:160-169
Implementation Infrastructure
Administrative settings and role configurations are supported by the underlying Python and PHP infrastructure. While the Telegram bot handles real-time commands, the MiniApp Control Panel manages the complex role assignments and logs.
Technical Stack for Administration
- Environment Variables: Sensitive tokens and log levels are managed via
.envfiles. - Session Handling: Managed via
Flask-Sessionto maintain admin state. - Database: Audit logs are stored in a MySQL backend, exportable via SQL or JSON.
Sources: bot.py:20-30, requirements.txt:5-6, README.md:163-173
Logging Configuration
The system uses standard Python logging for the bot component, which can be configured via environment variables to capture different levels of detail.
# bot.py lines 27-31
logging.basicConfig(
level=os.getenv("LOG_LEVEL", "INFO").upper(),
format="%(asctime)s %(levelname)s %(message)s",
)
logger = logging.getLogger(__name__)
Sources: bot.py:27-31
Admin Management and Audit Logs provide the necessary governance framework for scaling Telegram operations. By combining a three-tier role system with comprehensive security tracking, the platform ensures that channel managers can delegate tasks without compromising the integrity of the community or data.