Skip to content

feat: host role admin controls#339

Merged
ann7415 merged 19 commits into
mainfrom
228-host-role-admin-controls
Jan 18, 2026
Merged

feat: host role admin controls#339
ann7415 merged 19 commits into
mainfrom
228-host-role-admin-controls

Conversation

@ann7415

@ann7415 ann7415 commented Jan 18, 2026

Copy link
Copy Markdown
Contributor

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

  • Added a new AdminConsole class (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

  • Implemented IP ban functionality in 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

  • Added per-room username ban support to the Room class, 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

  • Added the ability to find a session ID by username in SessionManager, facilitating administrative actions by username as well as session ID. [1] [2] [3]

Thread Safety Improvements

  • Ensured thread safety in Room operations 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.

@ann7415 ann7415 self-assigned this Jan 18, 2026
@ann7415 ann7415 added the enhancement New feature or request label Jan 18, 2026
@ann7415 ann7415 requested a review from romain1717 as a code owner January 18, 2026 17:07
Copilot AI review requested due to automatic review settings January 18, 2026 17:07
@ann7415 ann7415 added the server Issues related to the server-side implementation. label Jan 18, 2026
@ann7415 ann7415 linked an issue Jan 18, 2026 that may be closed by this pull request
@ann7415 ann7415 added the network Networking, communication, or protocol-related tasks. label Jan 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread server/src/admin/AdminConsole.cpp Outdated
Comment thread server/src/room/room/Room.cpp
Comment thread server/src/room/room/Room.cpp
Comment thread server/src/room/room/Room.cpp
Comment thread server/src/admin/AdminConsole.cpp Outdated
Comment thread server/src/room/room/Room.cpp
Comment thread server/src/network/SessionManager/Manager/SessionManager.hpp Outdated
Comment thread server/src/network/SessionManager/interfaces/ISessionManager.hpp
Comment thread server/src/admin/AdminConsole.cpp

@romain1717 romain1717 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

21:57

@ann7415 ann7415 force-pushed the 228-host-role-admin-controls branch from fe5f5fc to 3360a80 Compare January 18, 2026 21:02
@ann7415 ann7415 merged commit 237c317 into main Jan 18, 2026
10 checks passed
@ann7415 ann7415 deleted the 228-host-role-admin-controls branch January 18, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request network Networking, communication, or protocol-related tasks. server Issues related to the server-side implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Host Role / Admin Controls

3 participants