M5: moderation, permissions, channel CRUD, in-app account management
- Server-side moderation & permissions (kick/ban/move/server-mute, channel CRUD). - Database schema v2: channels, bans; BLAKE2b channel passwords, Argon2id accounts. - C ABI additions and client-side handling (vc_kick_user, vc_ban_user, vc_set_permission, vc_set_server_mute, vc_move_user, vc_create/edit/delete_channel, vc_create/reset/delete/list_account). - vccli flags for all M5 operations plus --username/--password auth. - Four new tests covering permissions, kick/ban/move/mute, admin accounts, channel CRUD. - Docs: protocol.md envelope updates, security.md channel-password hashing, PROGRESS.md.
This commit is contained in:
@@ -57,6 +57,10 @@ class ConnSession : public std::enable_shared_from_this<ConnSession> {
|
||||
void send_envelope(const voicecat::v1::Envelope& env);
|
||||
void close();
|
||||
|
||||
// Called by SessionRegistry for kick/ban. Public so the registry can forcibly
|
||||
// close a session without making it a friend class.
|
||||
void send_disconnect_and_close(uint32_t code, const std::string& reason);
|
||||
|
||||
// ── M2: media key injection (called from on_tls_ready) ───────────────────
|
||||
void set_media_crypto(std::unique_ptr<voicecat::crypto::SodiumMediaCrypto> send,
|
||||
std::unique_ptr<voicecat::crypto::SodiumMediaCrypto> recv);
|
||||
@@ -87,6 +91,21 @@ class ConnSession : public std::enable_shared_from_this<ConnSession> {
|
||||
void handle_udp_binding(uint64_t req_id, const voicecat::v1::UdpBinding& msg);
|
||||
void handle_stream_announce(uint64_t req_id, const voicecat::v1::StreamAnnounce& msg);
|
||||
void handle_stream_stop(const voicecat::v1::StreamStop& msg);
|
||||
void handle_leave_channel();
|
||||
|
||||
// M5 handlers
|
||||
void handle_kick_request(uint64_t req_id, const voicecat::v1::KickRequest& msg);
|
||||
void handle_ban_request(uint64_t req_id, const voicecat::v1::BanRequest& msg);
|
||||
void handle_set_permission(uint64_t req_id, const voicecat::v1::SetPermissionRequest& msg);
|
||||
void handle_server_mute_request(uint64_t req_id, const voicecat::v1::ServerMuteRequest& msg);
|
||||
void handle_move_user(uint64_t req_id, const voicecat::v1::MoveUserRequest& msg);
|
||||
void handle_create_channel(uint64_t req_id, const voicecat::v1::CreateChannelRequest& msg);
|
||||
void handle_edit_channel(uint64_t req_id, const voicecat::v1::EditChannelRequest& msg);
|
||||
void handle_delete_channel(uint64_t req_id, const voicecat::v1::DeleteChannelRequest& msg);
|
||||
void handle_create_account(uint64_t req_id, const voicecat::v1::CreateAccountRequest& msg);
|
||||
void handle_reset_password(uint64_t req_id, const voicecat::v1::ResetPasswordRequest& msg);
|
||||
void handle_delete_account(uint64_t req_id, const voicecat::v1::DeleteAccountRequest& msg);
|
||||
void handle_list_accounts(uint64_t req_id, const voicecat::v1::ListAccountsRequest& msg);
|
||||
|
||||
void finish_guest_auth(const voicecat::v1::GuestAuth& guest, uint64_t req_id);
|
||||
void finish_password_auth(const std::string& username, const std::string& password,
|
||||
@@ -95,7 +114,13 @@ class ConnSession : public std::enable_shared_from_this<ConnSession> {
|
||||
const voicecat::v1::Permissions* perms = nullptr);
|
||||
void send_state_snapshot();
|
||||
void broadcast_user_joined(const voicecat::v1::User& user);
|
||||
void send_disconnect_and_close(uint32_t code, const std::string& reason);
|
||||
void send_generic_result(uint64_t req_id, bool ok, uint32_t code,
|
||||
const std::string& message);
|
||||
|
||||
// Permission helpers.
|
||||
bool has_permission(bool (voicecat::v1::Permissions::* getter)() const) const;
|
||||
bool is_admin() const { return has_permission(&voicecat::v1::Permissions::is_admin); }
|
||||
void set_permissions(const voicecat::v1::Permissions& perms);
|
||||
|
||||
std::shared_ptr<Database> db_;
|
||||
std::shared_ptr<SessionRegistry> registry_;
|
||||
@@ -126,6 +151,9 @@ class ConnSession : public std::enable_shared_from_this<ConnSession> {
|
||||
// support multiple concurrent streams (MIC + SCREEN_AUDIO + AUX_DEVICE) per user.
|
||||
uint32_t next_stream_id_{1};
|
||||
std::vector<uint32_t> announced_stream_ids_;
|
||||
|
||||
// M5: permissions granted at auth time (server-side authority).
|
||||
voicecat::v1::Permissions permissions_;
|
||||
};
|
||||
|
||||
} // namespace voicecat::server
|
||||
|
||||
Reference in New Issue
Block a user