feat: host role admin controls#339
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request introduces administrative controls through a new text-based admin console and implements IP and username ban management across the server. The changes add ban/unban capabilities both globally (IP bans) and per-room (username bans), with proper thread safety improvements to the Room class.
Changes:
- New AdminConsole class providing interactive server administration with commands for managing sessions, rooms, kicks, and bans
- IP ban management in SessionManager with automatic expiration cleanup and ban checks at all session creation points
- Per-room username ban support with thread-safe operations in the Room class
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/admin/AdminConsole.hpp | Defines the AdminConsole class interface with command handlers and utility methods |
| server/src/admin/AdminConsole.cpp | Implements admin console with command parsing, ban management, and interactive command loop |
| server/src/thread/ServerRuntime.hpp | Adds AdminConsole member variable |
| server/src/thread/ServerRuntime.cpp | Integrates AdminConsole lifecycle with server start/stop |
| server/src/room/room/Room.hpp | Adds username ban methods and removes const qualifiers for thread-safe operations |
| server/src/room/room/Room.cpp | Implements username ban logic with mutex protection for all session operations |
| server/src/room/manager/RoomManager.cpp | Adds ban check before allowing room joins |
| server/src/packet/PacketRouter/TCP/TCPPacketRouter.cpp | Adds IP ban check for incoming TCP connections |
| server/src/network/SessionManager/interfaces/ISessionManager.hpp | Extends interface with IP ban management and session lookup methods |
| server/src/network/SessionManager/Manager/SessionManager.hpp | Adds IP ban storage and method declarations |
| server/src/network/SessionManager/Manager/SessionManager.cpp | Implements IP ban management with expiration, ban checks across session operations, and findSessionIdByUsername |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5573622 to
2ce687d
Compare
…dability and safety
…better readability
…lined session handling
fe5f5fc to
3360a80
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This pull request introduces a comprehensive administrative console interface and adds robust IP and username ban management to the server. The changes enable banning and unbanning of IPs and users, both globally and within rooms, and provide supporting APIs and thread safety improvements. The SessionManager now tracks banned IPs, and the Room class manages banned usernames with proper locking.
Key changes include:
Administrative Console
AdminConsoleclass (AdminConsole.hpp) that provides a text-based interface for server administration, including commands for status, session/room listing, kicking/banning users, and managing IP bans.Session/IP Ban Management
SessionManager, including methods to ban/unban IPs, check if an IP is banned, and list current bans. IP bans are automatically cleaned up after expiration, and all session-creation and authentication paths now check for banned IPs. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Username/Room Ban Management
Roomclass, including methods to ban/unban usernames and check if a username is banned. Room join/leave and query operations are now thread-safe via mutex locking. [1] [2] [3] [4] [5] [6]Session/User Lookup
SessionManager, facilitating administrative actions by username as well as session ID. [1] [2] [3]Thread Safety Improvements
Roomoperations by introducing scoped locks for all methods that access or modify session or ban data. [1] [2] [3] [4] [5]These changes significantly improve the server's administrative capabilities and security by allowing dynamic, real-time management of users and IPs.